Skip to content

[DAM analyzer] Port DAM binding logic to analyzer #2339

Closed
@sbomer

Description

@sbomer

The Roslyn analyzer needs to be able to produce warnings for reflection-access to reflection-annotated methods. Whenever we see a reflection pattern that accesses, for example, PublicMethods on a particular type, we need to be able to find all public methods on the type.

The binding logic from https://github.com/dotnet/linker/blob/main/src/linker/Linker.Dataflow/DynamicallyAccessedMembersBinder.cs should be ported to work with Roslyn, and made to produce these warnings. To do this, I would start by enabling a few tests from https://github.com/dotnet/linker/blob/main/test/Mono.Linker.Tests.Cases/DataFlow/AnnotatedMembersAccessedViaReflection.cs in the feature/damAnalyzer branch (which has early support for DynamicallyAccessedMembersAttribute).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions