Trim analyzer should warn on unnecessary DynamicallyAccessedMembers

Open
#109,802 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
tooling

Research direction

Start with the linked pull request comment and issue 88512 to understand the existing analyzer behavior and narrower annotations. Define the method-parameter dataflow cases covered by the request, then determine how warning behavior should be validated; the issue names no files or tests.

Written by the indexing model from the issue text.

Description

area-Tools-ILLink

Context: https://github.com/dotnet/runtime/pull/109772#issuecomment-2474856235

It would be nice if the analyzer could warn on DynamicallyAccessedMembers annotations that preserve more than is necessary. This would be hard to do when a Type "escapes" to an annotated field, but sounds reasonable at least when the dataflow only involves annotated method parameters.

This would help move away from DynamicallyAccessedMembers.All annotations to the less broad annotations added for https://github.com/dotnet/runtime/issues/88512.

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.