FW: [Mono-devel-list] Questions on security attributes

Sebastien Pouliot spouliot at videotron.ca
Fri Sep 17 13:22:34 EDT 2004

Forgot to c.c. the list :(

-----Original Message-----

Hello Alexis,

>I'm at the compiler part. The compiler parses the [Attribute] from
>source and creates a CustomAttributeBuilder with all the data, which
>it then passes to AssemblyBuilder.SetCustomAttribute. The
>AssemblyBuilder does not have an AddDeclarativeSecurity(); that's for
>methods, for now I'm working on security request permissionsets
>(RequestMinimum,Optional and Refuse) that exist only on assembly

There is a patch, under review, where compiler (MCS) takes care of this.
But this has nothing to do with using CustomAttributeBuilder (this is the
wrong road ;-).

Things get even funnier with 2.0 because the security attributes are no more
encoded as XML - but just like any other attribute. However they are still
located apart from normal attributes (so the all *CustomAttribute* still
won't work on them).

>So I want to execute the attribute, as you say to generate the XML.
>How do I do that when I only have a CustomAttributeBuilder? The only
>method I found that does something like this is
>mono_custom_attrs_construct whose arguments I can fill in from the
>data I can get from CustomAttributeBuilder.
>Or is there a point in the compiler where the attribute is fully
>constructed? I doubt it, though.

Actually the changes required to support assembly-level security attributes
are S.R.E and runtime related. Using the right values in AssemblyBuilder
should* be enough.

* as we leave in a imperfect world this isn't really the case for MCS (but
could have been ;-).

Sebastien Pouliot
home: spouliot at videotron.ca
blog: http://pages.infinit.net/ctech/poupou.html

More information about the Mono-devel-list mailing list