I'm writing a class library that will be consumed by other applications, both
web and form, and may also be loaded dynamically. I need the assembly to
perform some validation immediately after it is loaded, and possibly shut
itself down. I cannot find an event or mechanism to detect when my assembly
is loaded. Any suggestions?
AlexS - 18 Jul 2005 22:28 GMT
Depends on how you interpret "loaded".
If some pgm reads assembly as binary file and does something with its
content - is it loaded or just read? See reflector or anakrino. There
couldn't be any in-assembly event except in-OS, like windows hook which
intercepts file reads. Of course, if you are thinking Windows.
Otherwise, as soon as code starts to run in your assembly it is "loaded and
executed"
HTH
Alex
> I'm writing a class library that will be consumed by other applications, both
> web and form, and may also be loaded dynamically. I need the assembly to
> perform some validation immediately after it is loaded, and possibly shut
> itself down. I cannot find an event or mechanism to detect when my assembly
> is loaded. Any suggestions?
Lloyd Dupont - 19 Jul 2005 00:09 GMT
after reading the previous peace of useless advice I though it was time to
right the wrong ;-)
AppDomain.CurrentDomain.AssemblyLoad += new
AssemblyLoadEventHandler(myHandler);
sometimes a quick look in the documentation it's all it takes!
> I'm writing a class library that will be consumed by other applications,
> both
[quoted text clipped - 3 lines]
> assembly
> is loaded. Any suggestions?