I'm having the following issue trying to use custom attributes:
GetType().GetTypeInfo().GetCustomAttributes();
GetType().GetTypeInfo().GetCustomAttributes(true);
GetType().GetTypeInfo().GetCustomAttributes<MyClass>();
GetType().GetTypeInfo().GetCustomAttributes<MyClass>(true);
GetType().GetTypeInfo().GetCustomAttributes(typeof(MyClass));
GetType().GetTypeInfo().GetCustomAttributes(typeof(MyClass), true);
GetType().GetTypeInfo().GetCustomAttribute(typeof(MyClass));
GetType().GetTypeInfo().GetCustomAttribute(typeof(MyClass), true);
GetType().GetTypeInfo().GetCustomAttribute<MyClass>();
GetType().GetTypeInfo().GetCustomAttribute<MyClass>(true);
All result in System.ArgumentNullException: Argument cannot be null. Parameter name: type.
I've verified that GetType()
and GetType().GetTypeInfo()
both return appropriate values. It seems to me that something fundamental to all these methods and extension methods is failing, at the very least GetCustomAttributes()
should always return given a valid MemberInfo
(GetTypeInfo()
) object.
Any help is appreciated. I'm blocked on this issue and I've beat my head against it every way I can think of.
Thanks,
Gabe