Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ReflectionAccessAnalyzer logic more similar to ILLink/ILC #105956

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Aug 5, 2024

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.

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.
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 5, 2024
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 5, 2024
@sbomer sbomer requested a review from a team August 5, 2024 22:12
@sbomer
Copy link
Member Author

sbomer commented Aug 6, 2024

/ba-g "unrelated timeout in IcuSharding test"

@sbomer sbomer merged commit d5af5bd into dotnet:main Aug 6, 2024
74 of 77 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linkable-framework Issues associated with delivering a linker friendly framework needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners
Projects
None yet
2 participants