IL2082: 'target parameter' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to 'target method'. The implicit 'this' argument of method 'source method' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to

Cause

The target location declares some requirements on the type value via its DynamicallyAccessedMembersAttribute. Those requirements must be declared by the source value also via the DynamicallyAccessedMembersAttribute. The source value can declare more requirements than the target, if necessary.

Example

void NeedsPublicConstructors([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type)
{
    // ...
}

// This can only happen within methods of System.Type type (or derived types). Assume the below method is declared on System.Type
void TestMethod()
{
    // IL2082 Trim analysis: 'type' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to 'NeedsPublicConstructors'. The implicit 'this' argument of method 'TestMethod' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
    NeedsPublicConstructors(this);
}