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

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

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-karasAugust 6, 2024 16:37
@sbomer

Copy link
Copy Markdown
MemberAuthor

@dotnet/illink PTAL

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

Labels

Projects

None yet

2 participants

@sbomer@jtschuster