Make ReflectionAccessAnalyzer logic more similar to ILLink/ILC#105956
Merged
sbomer merged 2 commits intodotnet:mainfrom Aug 6, 2024
Merged
Make ReflectionAccessAnalyzer logic more similar to ILLink/ILC#105956sbomer merged 2 commits intodotnet:mainfrom
sbomer merged 2 commits intodotnet:mainfrom
Conversation
Instead, report them immediately.
ReflectionAccessAnalyzer will need to be able to produce diagnostics with differing locations for a single call to GetReflectionAccessDiagnostics, to support warnings for DynamicallyAccessedMembers on type. This matches ReflectionMarker in ILLink and ILC, where MarkTypeForDynamicallyAccessedMembers takes a MessageOrigin rather than a DiagnosticContext.
This was referenced Aug 5, 2024
Closed
vitek-karas
approved these changes
Aug 6, 2024
Member
Author
|
/ba-g "unrelated timeout in IcuSharding test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ReflectionAccessAnalyzer is analogous to ILLink/ILC's ReflectionMarker, and will be responsible for producing warnings about DynamicallyAccessedMembers on types when we fix #102002. These warnings will not all have the same location since they can be reported on different members of the type.
To support this, this is changing ReflectionAccessAnalyzer to create a DiagnosticContext as needed when reporting a warning, instead of taking it as an argument, which would require all warnings to share the same location (since DiagnosticContext holds a Location). This is similar to how ReflectionMarker takes a MessageOrigin instead of DiagnosticContext.
The first change makes DiagnosticContext report warnings immediately, instead of using it as a bag of warnings to be reported later. The second change does the factoring in ReflectionAccessAnalyzer.