How prevent the crash and exit gracefully?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Boris (Boris_at_discussions.microsoft.com)
Date: 11/29/04


Date: Mon, 29 Nov 2004 15:37:03 -0800

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?

I was told that CLR doesn't load anything untill it needs it. OK, but how to
prevent the crash I described above and exit gracefully like in VC++ 6.0
case?

Can anyone clarify this situation?
Thanks
Boris



Relevant Pages

  • Re: The W problem
    ... "Rob Giordano (aka: Crash Gordon®)" ... system font to Arial I now see the missing part of the W on system ...
    (microsoft.public.frontpage.client)
  • Why application is allowed to run if dependent assembly is missing
    ... I notice the following strange behavior of the applications running under ... .NET Framework. ... The MyAssembly.dll is strong named assembly, which is installed in the GAC. ... some dll's are missing and application would gracefully exit. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Which crash next?
    ... Unless he feels he is missing a sound, ... suggested a bigger crash. ... > Opinions of other drummers should be taken lightly because what sounds ...
    (rec.music.makers.percussion)
  • Re: MFC: adding a control into a dialog window
    ... I am using a button ID_ENABLE to trigger the adding of label into IDD_HELLO_DIALOG. ... The program would crash when I hit the button. ... The big thing you are missing is telling us what the dialog assertion says. ... GetDlgItemwill get the CWnd* of a child control of the dialog, ...
    (microsoft.public.vc.mfc)
  • Re: MFC: adding a control into a dialog window
    ... The program would crash when I hit the button. ... The big thing you are missing is telling us what the dialog assertion says. ... But I would imagine that the problem is that your parentwnd is NULL. ... GetDlgItemwill get the CWnd* of a child control of the dialog, and there is not one with the ID IDD_HELLO_DIALOG. ...
    (microsoft.public.vc.mfc)