Is it possible to discover SecurityAttributes in the Reflection Only context?

Hi, I'm doing some stuff with the Reflection-Only context at the moment and I'm running into a bit of trouble with discovering security-related attributes defined on a member. I can use CustomAttributeData.GetCustomAttributes to find most things, but I since SecurityAttribute classes are just pseudo-custom-attributes, they don't show up.

Is there any other way to detect these?

[384 byte] By [mcobrien] at [2007-12-22]
# 1

Unfortunately the current reflection object model does not expose the security attributes (either in the Reflection-Only or standard contexts). You've pointed out the reason -- security attributes are not real custom attributes, in that they have their own metadata table and are stored seperately from the custom attributes that reflection exposes. You can use PermCalc in v2.0 and PermView in v1.x to display this information on the command line, but there is no supported way to access it directly.

-Shawn

ShawnFarkas-MS at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Hi Shawn, thanks for the help!

I actually can get the security attributes and other pseudo-attributes in the standard context -- looking in Reflector, CustomAttribute.GetCustomAttributes merges theses with the real ones -- but I'll hopefully find a way to work around this in the reflection only context.

cheers
Michael

mcobrien at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified