Skip to content

Consider detecting unnecessary annotations #117170

@vitek-karas

Description

@vitek-karas

This came as feedback from the team annotating libraries. It's likely that libraries contain unnecessary annotations, specifically RequiredUnreferencedCode and possibly even unnecessary suppressions UnconditionalSuppressMessage.
This can happen for multiple reasons, the most common ones:

  • Incorrect understanding of warnings and behavior of the linker, leading to over-annotation the code.
  • Improvements in the linker - code which needed annotation/suppression is fully recognized now
  • Simple bugs
  • Changes to the code which make existing annotations/suppressions stale

Ideally this would be implemented in the Roslyn analyzer as code fixes/suggestions - definitely not warnings.
But until then, linker can probably figure out good chunk of these as well and could report them as simple info-messages to the output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzers

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions