Skip to content

ILLink analyzer: add warnings for DAM on type#105994

Merged
sbomer merged 6 commits into
dotnet:mainfrom
sbomer:damOnType
Aug 19, 2024
Merged

ILLink analyzer: add warnings for DAM on type#105994
sbomer merged 6 commits into
dotnet:mainfrom
sbomer:damOnType

Conversation

@sbomer

@sbomer sbomer commented Aug 5, 2024

Copy link
Copy Markdown
Member

Implements analyzer warnings for DynamicallyAccessedMembers annotations on types.
The warnings are generated the same way ILLink does in "library mode" - so the presence of DAM on a type is sufficient to warn on any referenced members that have RUC or DAM annotations. It doesn't need object.GetType() to be called on an instance of a derived type.

Fixes #104742
Fixes #102002

Depends on #105956

sbomer added 4 commits August 5, 2024 16:05
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.
@sbomer sbomer marked this pull request as ready for review August 6, 2024 16:37
@sbomer sbomer requested review from a team and vitek-karas August 6, 2024 16:37
@sbomer

sbomer commented Aug 13, 2024

Copy link
Copy Markdown
Member Author

@dotnet/illink PTAL

Comment thread src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/FlowAnnotations.cs Outdated
Fix typos
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants