I am getting the following error from the description attribute as follows:
Attribute ‘Description’ is not valid on this declaration type. It is
only valid on ‘method’ declarations.
public enum TestEnum
{
[Description("Property 1")]
Property1,
}
I have never had this error before and Google isn’t shedding much light. I guess it is a reference issue, but I’m not really sure.
The
DescriptionAttributecan be applied to virtually any type of member, including enum values. Are you sure you’re using the right[Description]? Make sure you reference the assembly it comes from:And, if you do happen to have two different attributes called ‘Description’ in your scope, prefix it with the namespace to remove the ambiguity, i.e.