CF 2.0 SP1: lifetime of a assembly attribute ?

  • Thread starter Thread starter Steve B.
  • Start date Start date
S

Steve B.

Hi,

In my application written in C#, I'd like to know when is the constructor of
an attribute with assembly scope called.

The final goal is to catch each loading of an assembly in order to verify
the version of an assembly in a screen available to hotliners.

An other way would be to use
AppDomain.GetCurrentAppDomain().GetAssemblies(), but it does not seems to be
available in CF.net.

Thanks in advance for any help
Steve
 
It is called when you call the GetCustomAttributes method on an instance of
an Assembly, e.g.

object[] attribs =
Assembly.GetExecutingAssembly().GetCustomAttributes(false);

This can easily be tested by adding a line to your attribute's constructor
similiar to this:

public MyVersionAttribute(string version)
{
MessageBox.Show("MyVersionAttribute .ctor called.");
}

--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.

http://www.opennetcf.com/
 
Back
Top