PC Review


Reply
Thread Tools Rate Thread

Can you detect when your assembly is loaded?

 
 
=?Utf-8?B?SmVmZiBMYXI=?=
Guest
Posts: n/a
 
      18th Jul 2005
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?
 
Reply With Quote
 
 
 
 
AlexS
Guest
Posts: n/a
 
      18th Jul 2005
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

"Jeff Lar" <Jeff (E-Mail Removed)> wrote in message
news:9646875D-D77A-4B27-92D3-(E-Mail Removed)...
> 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?



 
Reply With Quote
 
Lloyd Dupont
Guest
Posts: n/a
 
      19th Jul 2005
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!


"Jeff Lar" <Jeff (E-Mail Removed)> wrote in message
news:9646875D-D77A-4B27-92D3-(E-Mail Removed)...
> 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?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unload an Assembly loaded via Assembly.LoadFrom() GD Microsoft Dot NET Compact Framework 4 10th Aug 2006 04:12 AM
Can you detect when your assembly is loaded? =?Utf-8?B?SmVmZiBMYXI=?= Microsoft Dot NET 2 19th Jul 2005 01:19 AM
How to unload an assembly that is loaded with Assembly.LoadForm Lloyd Sheen Microsoft Dot NET Framework 1 11th May 2004 04:16 PM
How to unload an assembly that is loaded with Assembly.LoadForm Lloyd Sheen Microsoft Dot NET 0 29th Apr 2004 03:45 PM
Re: how to programatically give assembly loaded from network the same trust as those loaded from local host? Marcelo Birnbach [MS] Microsoft Dot NET Framework 0 28th Jun 2003 12:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:25 AM.