IL2042: Could not find a unique backing field to propagate the 'DynamicallyAccessedMembersAttribute' annotation on a property
Cause
The trimmer could not determine the backing field of a property annotated with DynamicallyAccessedMembersAttribute.
Example
// IL2042: Could not find a unique backing field for property 'MyProperty' to propagate 'DynamicallyAccessedMembersAttribute'
[DynamicallyAccessedMembers(DynamicallyAccessedMemberType.PublicMethods)]
public Type MyProperty
{
get { return GetTheValue(); }
set { }
}
// To fix this annotate the accessors manually:
public Type MyProperty
{
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberType.PublicMethods)]
get { return GetTheValue(); }
[param: DynamicallyAccessedMembers(DynamicallyAccessedMemberType.PublicMethods)]
set { }
}
Feedback
Issottometti u ara feedback għal