Skip to content

Analyzer doesn't warn about reflection access to generated backing fields #2628

Open
@vitek-karas

Description

@vitek-karas

For example:

public class TestType
{
    [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
    public Type AnnotatedProperty { get; set; }
}

public void Test ()
{
    typeof (TestType).RequiresNonPublicFields (); // IL2110 - this accessed the compiler generated backing field for the AnnotatedProperty
}

Analyzer doesn't produce this warning for compiler generated backing fields (it does produce it for normal declared field).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions