Why doesn't GetCustomAttributes(true) return attributes where AttributeUsageAttribute.Inherited = false? There is nothing in the documentation that I can see that says that these two should interact. The following code outputs 0.
class Program
{
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
class NotInheritedAttribute : Attribute { }
[NotInherited]
class A { }
class B : A { }
static void Main(string[] args)
{
var attCount = typeof(B).GetCustomAttributes(true).Count();
Console.WriteLine(attCount);
}
}