Open sandboxFocusImprove this doc

PS0054: Multicast Attribute Class With Several Usage Attributes

Severity Error
Reported by PostSharp
Message The type "<Type>" cannot be decorated by more than one instance of MulticastAttributeUsageAttribute.

Cause

The MulticastAttributeUsageAttribute of a class derived from MulticastAttribute, such as an aspect, says on which declarations the attribute can be applied and how it is multicast. See Understanding Attribute Multicasting. A class can inherit this usage from its base classes and override it, but each class can carry only one MulticastAttributeUsageAttribute.

PostSharp reports PS0054 when <Type>, the attribute class or one of its base classes, carries more than one. The usage of the attribute is then unknown, so PostSharp skips its instances.

The C# and Visual Basic compilers already reject a second MulticastAttributeUsageAttribute on a class, because the attribute does not allow multiple instances (CS0579 in C#). Only an assembly produced or rewritten by another tool, such as an IL assembler or an IL rewriter, can contain such a class.

This message depends on an assembly that the C# compiler cannot produce, so no example can show it.

Resolution

See Also

Reference

MulticastAttributeUsageAttribute
MulticastAttribute

Other Resources

Understanding Attribute Multicasting