You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the following code, the trimmer will issue a warning at trim time, but the Roslyn analyzer won't warn.
classFoo{[RequiresUnreferencedCode("")]publicstaticvoidBar(){}}classBar<T>:Foo{}classTest{publicstaticvoidMethod(){Method2(typeof(Bar<>));// Warns here in the linker, but not in the analyzer}privatestaticvoidMethod2([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]Typetype){}}
We traced this down to the behavior in Roslyn around "unbound constructed generic types", or more specifically Bar<>, as compared to Bar<T>. Bar<T> is the original definition and has full fidelity in the Roslyn type system. However, Bar<> is considered an "unbound constructed generic" and as a result has a few limitations in the Roslyn type system.
These limitations cause this particular case to be missed by the analyzer built on top of the Roslyn type system, whereas the Cecil type system captures this case.
The text was updated successfully, but these errors were encountered:
Do you know if there are ways to solve this in the analyzer? The docs simply say that BaseType is unavailable on such symbol - but doesn't say what to do about it :-(.
@agocke was suggesting to use the generic type definition (not sure if I'm using the right terminology for Roslyn) in places where we encounter unbound generic types instead.
Given the following code, the trimmer will issue a warning at trim time, but the Roslyn analyzer won't warn.
We traced this down to the behavior in Roslyn around "unbound constructed generic types", or more specifically
Bar<>
, as compared toBar<T>
.Bar<T>
is the original definition and has full fidelity in the Roslyn type system. However,Bar<>
is considered an "unbound constructed generic" and as a result has a few limitations in the Roslyn type system.These limitations cause this particular case to be missed by the analyzer built on top of the Roslyn type system, whereas the Cecil type system captures this case.
The text was updated successfully, but these errors were encountered: