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 2006

Tip: Looking for answers? Try searching our database.

Help with registering AssemblyResolve event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lithel@gmail.com - 26 Jul 2006 21:19 GMT
I am writing an application that uses a set of library assembly dlls
that are located in a command line passed location.  Originally, I
tried to solve this problem by creating an AssemblyResolve handler and
registering it very early in hte main function.

The problem is that the application actually uses some of these
assemblies.  In particular, one of the classes (named MainWindow)
derives from a class in the library.  If the runtime attempts to create
a MainWindow before the handler is loaded, then I have a problem.

Fair enough.  However, the way I understand the JIT, I thought it would
not attempt to load dependent libraries until the class is used or a
static call is made on that class.  I made a seperate "Launcher" class
that the main funciton and the handler, but I am still failing to
resolve the assembly before I even reach my main function.

I am reasonably certain that if I wrote an entire launcher assembly
then this method would work, but I'm hoping there's a "cleaner" way to
fix this problem.  Has anyone ever run into this problem?
lithel@gmail.com - 26 Jul 2006 22:27 GMT
Alright, I actually figured this out, and it was a silly mistake on my
part.  In the main function I had:

Application.Run(new MainWindow())

which uses the main window!  That's why the JIT was trying to load the
external assembly (since MainWindow inherits from a class in there).
Fixed it by writing another method called "StartApp" that includes that
one line and then calling that function where I used to have the
Application.Run line.

> I am writing an application that uses a set of library assembly dlls
> that are located in a command line passed location.  Originally, I
[quoted text clipped - 15 lines]
> then this method would work, but I'm hoping there's a "cleaner" way to
> fix this problem.  Has anyone ever run into this problem?

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.