"Not that I have any intention of using this...  Needing a whole separate
assembly is rather inconvenient, and it feels like an abuse of the
underlying mechanism.  But I think you knew that..."

I know ... The separate assembly during compilation appears to be
unavoidable, but there might be a way to avoid shipping the assembly with
the application. When the compiler processes the custom permission
attribute, it creates an instance of the permission class, it then calls
ToXml( ) in order to obtain a persistable representation of the custom
permission, which it then writes to the output assembly metadata. This
metadata includes the fully qualified name of the permission type. It is
certainly possible for ToXml( ) to return a different type name than the one
used during compilation, one that exists in the main assembly.

I run a quick test which appears to confirm that this is possible. I made a
copy of the custom permission class, changed the class name by appending
'.Runtime' to the namespace, and included the class in the test program. I
then changed the ToXml( ) method in the custom permission assembly so that
it returned a reference to the permission class in the '.Runtime' namespace
(Unfortunately, I cannot think of a mechanism other than hard-coding the
type name). I build the program, deleted the custom permission assembly, and
confirmed that the program would still execute correctly.

Not that any of this makes the solution any prettier, so there's no need to
comment in this regard :). And concerning 'the abuse of the underlying
mechanism', I know you are right but I my dark side disagrees...

Fernando Tubio


----- Original Message -----
From: "Ian Griffiths" <[EMAIL PROTECTED]>
Sent: Monday, January 31, 2005 6:12 AM
Subject: Re: Determing time when a assembly was built


Cool - that's exactly the kind of obscure detail I was hoping for!

Not that I have any intention of using this...  Needing a whole separate
assembly is rather inconvenient, and it feels like an abuse of the
underlying mechanism.  But I think you knew that...

Of course a wholly less practical solution could also be built out of
reparse points and/or file system filters.  :-)


--
Ian Griffiths - DevelopMentor
http://www.interact-sw.co.uk/iangblog/

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to