Skip to content

ILLink: Trimmer, NativeAOT, and Trim analyzer have inconsistent UnsafeAccessor behavior #101195

Open

Description

@jtschuster

Taken from a comment:

NativeAOT has basically the best behavior in these cases - it produces the same warnings
as if the accessor has a direct access to the target member. So if the accessor is correctly annotated
there will be no warnings.

Trimmer is the worst - due to the fact that we mark all methods with a given name, we can't compare
annotations and thus we need to warn on all annotated methods. In addition the accesses are modeled
as reflection accesses so the warning codes are "Reflection" codes. When/If we implement
correct target resolution, we should be able to emulate the behavior of NativeAOT

Analyzer doesn't warn at all in these cases - analyzer simply can't resolve targets (at least sometimes)
and so for now we're not doing anything with UnsafeAccessor in the analyzer.

Activity

  1. added
    area-Tools-ILLink
    on Apr 17, 2024
  2. added
    untriaged
    on Apr 17, 2024
  3. dotnet-policy-service commented on Apr 17, 2024

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
    See info in area-owners.md if you want to be subscribed.

  4. added this to the Future milestone on Apr 17, 2024
  5. removed
    untriaged
    on Apr 17, 2024
  6. changed the title [-]Trimmer, NativeAOT, and Trim analyzer have inconsistent UnsafeAccessor behavior[/-] [+]ILLink: Trimmer, NativeAOT, and Trim analyzer have inconsistent UnsafeAccessor behavior[/+] on Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions