Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Can you detect when your assembly is loaded?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Lar - 18 Jul 2005 20:01 GMT
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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.