Skip to content

ILLink analyzer doesn't see operator method annotations #119110

Description

@sbomer

The ILLink Roslyn analyzer doesn't properly handle operator methods. It doesn't see annotated operator method parameters, and instead treats operator method returns as unknown values:

Repro:

var result = new OperatorType() - new OperatorType();
result.RequiresPublicMethods(); // Should report IL2072 about mismatch. Instead reports IL2062 (unknown value passed to RequiresPublicMethods).

private sealed class OperatorType : TestSystemTypeBase
{
    [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)]
    public static Type operator -(OperatorType left, OperatorType right) => ...
}

Annotated operator parameters are similar. This is a very niche scenario since it requires defining operators for annotatable types (System.Type for example).

Activity

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.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