IL2114: 'DynamicallyAccessedMembersAttribute' on 'type' or one of its base types references 'member' which has 'DynamicallyAccessedMembersAttribute' requirements


A type is annotated with RequiresUnreferencedCodeAttribute indicating that the type may dynamically access some members declared on the type or its derived types. This instructs the trimmer to keep the specified members, but one of them is annotated with RequiresUnreferencedCodeAttribute which can not be statically verified. The RequiresUnreferencedCodeAttribute annotation may be directly on the type, or implied by an annotation on one of its base or interface types. This warning originates from the member with RequiresUnreferencedCodeAttribute requirements.


public class AnnotatedType {
    // Trim analysis warning IL2114: System.Type AnnotatedType::Field: 'DynamicallyAccessedMembersAttribute' on 'AnnotatedType' or one of its
    // base types references 'System.Type AnnotatedType::Field' which has 'DynamicallyAccessedMembersAttribute' requirements .
    public static Type Field;