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
When using MakeGenericType/MakeGenericMethod, IL2026 is understandably generated since some generic type parameters may be annotated with DynamicallyAccessedMemberAttribute, but that can't be taken into account by the linker when the type/method isn't known at compile-time.
However, when the type/method is known at compile-time, it seems like the linker could verify whether annotations exist on generic type parameters, and not emit the warning if not:
From other issues in this repo, it seems that improved support for MakeGenericType/MakeGenericMethod is maybe already in the works - feel free to close this issue if this is already planned etc.
The text was updated successfully, but these errors were encountered:
This is analyzer-only problem. Meaning the warning is only generated by the roslyn analyzer either in IDE or build. It should NOT be generated by the linker when trimming.
#2209 fixes the analyzer to not issue the warning, but that fix didn't make it into the SDK yet. It's in the 6.0.2xx branch in dotnet/linker, so hopefully it should make it to 6.0.200 SDK eventually.
@vitek-karas I can confirm that setting <EnableTrimAnalyzer>false</EnableTrimAnalyzer> makes this go away, so that corresponds to what you wrote, thanks!
When using MakeGenericType/MakeGenericMethod, IL2026 is understandably generated since some generic type parameters may be annotated with DynamicallyAccessedMemberAttribute, but that can't be taken into account by the linker when the type/method isn't known at compile-time.
However, when the type/method is known at compile-time, it seems like the linker could verify whether annotations exist on generic type parameters, and not emit the warning if not:
From other issues in this repo, it seems that improved support for MakeGenericType/MakeGenericMethod is maybe already in the works - feel free to close this issue if this is already planned etc.
The text was updated successfully, but these errors were encountered: