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 / Languages / Managed C++ / November 2004

Tip: Looking for answers? Try searching our database.

Why application is allowed to run if dependent assembly is missing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Boris - 29 Nov 2004 16:57 GMT
I notice the following strange behavior of the applications running under
.NET Framework.

Let say I have application MyApp.exe which reference assembly MyAssembly.dll.
The MyAssembly.dll is strong named assembly, which is installed in the GAC.

I notice that if MyAssembly.dll is not installed in GAC or the different
version
of MyAssembly.dll is installed in GAC then MyApp.exe starts OK. But as soon as
the MyApp.exe app tries to call any function from the MyAssembly.dll the
MyApp.exe
application crashes.

In unmanaged VC++ 6.0 world the application wouldn't even allowed to start
if some dll are missing. The system would display error message saying that
some dll's are missing and application would gracefully exit.

I wonder whether I misunderstand something or made any mistake? Why
MyApp.exe is allowed to start in order to crash right after attemp to use any
functionality from missing dependent assembly?

Can anyone clarify this situation?
Thanks
Boris
Tomas Restrepo \(MVP\) - 30 Nov 2004 01:30 GMT
Hi Boris,

> I notice the following strange behavior of the applications running under
> .NET Framework.
[quoted text clipped - 16 lines]
> MyApp.exe is allowed to start in order to crash right after attemp to use any
> functionality from missing dependent assembly?

Nope; it's working just as expected. The runtime will only load an assembly
when it needs to. This, btw, helps insure you don't load things you're not
gonna use, and, it enables some interesting scenarios with web-distributed
rich client applications (since you only have to download when you use it;
what you don't use doesn't need to be transferred at all!)

Signature

Tomas Restrepo
tomasr@mvps.org

Boris - 30 Nov 2004 02:55 GMT
OK, this is not , this is "feature".
But how can I prevent the ugly crashes in described above situation and exit
gracefully?

Thanks
Boris

"Tomas Restrepo (MVP)" wrote:

> Hi Boris,
>
[quoted text clipped - 29 lines]
> rich client applications (since you only have to download when you use it;
> what you don't use doesn't need to be transferred at all!)
Nishant S - 30 Nov 2004 05:06 GMT
Exception Handling :-)

Signature

Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */

> OK, this is not , this is "feature".
> But how can I prevent the ugly crashes in described above situation and exit
[quoted text clipped - 38 lines]
> > rich client applications (since you only have to download when you use it;
> > what you don't use doesn't need to be transferred at all!)

Rate this thread:







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.