Doc says:
/// Throws when multiple attributes are found (the attribute must allow multiple).
Implementation:
Attribute[] cachedAttributes = GetCustomAttributesCached(attributeProvider, inherit);
foreach (Attribute cachedAttribute in cachedAttributes)
{
if (cachedAttribute is TAttribute cachedAttributeAsTAttribute)
{
return cachedAttributeAsTAttribute;
}
}
return null;
This method is called for the following attributes:
AsyncStateMachineAttribute
- Already doesn't allow multiple. So it's okay.
TimeoutAttribute
- Already doesn't allow multiple. So it's okay.
PriorityAttribute
- Already doesn't allow multiple. So it's okay.
ClassInitializeAttribute
- Already doesn't allow multiple. So it's okay.
ClassCleanupAttribute
- Already doesn't allow multiple. So it's okay.
TestClassAttribute
- We should throw if multiple are found. We cannot force it to not allow multiple because it's not sealed.
TestMethodAttribute
- We should throw if multiple are found. We cannot force it to not allow multiple because it's not sealed.
Doc says:
Implementation:
This method is called for the following attributes:
AsyncStateMachineAttributeTimeoutAttributePriorityAttributeClassInitializeAttributeClassCleanupAttributeTestClassAttributeTestMethodAttribute