Skip to content

ILLink analyzer doesn't warn for invalid annotations in top-level methods #101215

Open
@sbomer

Description

@sbomer

DynamicallyAccessedMembers annotations are not supported for arbitrary types. The ILLink analyzer normally produces IL2098 warnings when the annotations are applied to unsupported types, but this isn't working for top-level methods:

using System.Diagnostics.CodeAnalysis;

RequireAll(GetFoo());

// This should warn
static void RequireAll([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Foo f) {}

static Foo GetFoo() => new Foo();

class Foo {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzersblockedIssue/PR is blocked on something - see comments

    Type

    No type

    Projects

    • Status

      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions