Skip to content

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Jul 21, 2022

Fixes #2906

I'll update this to remove ExpectedWarnings from the tests added in #2907 after that is merged.

@sbomer sbomer requested a review from marek-safar as a code owner July 21, 2022 16:23
@sbomer sbomer requested a review from vitek-karas July 21, 2022 16:23
Comment on lines +31 to +32
GetAnnotations (method.DeclaringType).TryGetAnnotation (method, out var methodAnnotations)
&& (methodAnnotations.ReturnParameterAnnotation != DynamicallyAccessedMemberTypes.None || methodAnnotations.ParameterAnnotations != null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to work differently in NativeAOT - where we might have to rely on dataflow to handle generic argument dataflow - it's not clear yet though.

@sbomer sbomer merged commit dbb51b0 into dotnet:main Jul 21, 2022
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
This avoids unnecessarily running the reflection methodbody scanner in
the linker, and the dataflow analysis in the analyzer, for methods
that were previously only triggering dataflow analysis due to
annotated generic parameters.

This eliminates unnecessary warnings for reflection access to
compiler-generated code.

Commit migrated from dotnet/linker@dbb51b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce noisy warnings for compiler generated code marked as reflectable

2 participants