Skip to content

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

@jtschuster

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.

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