Hi Naveen,
Sorry to disappoint you. The technique in that URL is completely useless to
handle the scenario I have described.
It is only good if you do not have a try/catch block around the most
outer
layer. If you have access to code, it is a simple matter to use a try
catch(Exception ).
If you have one of your dependent assembly missing, as described in my
scenario, during loading of the primary app domain, that technique is of no
use. It is fired before it reaches the Main(). That's before you even
have a
chance to install your that handler.
You can revisit my initial posting, construct a hello world program which
uses a class, packaged in another assembly to say hello. Removed that
supporting assembly and run your program. Install that unhandled
exception
handler as per the bottom of that URL for console app.
For your information, here is the first few lines of the error report (with
the unhandled exception handler installed):
Unhandled Exception: System.IO.FileNotFoundException: File or assembly name
MySupport, or one of its dependencies, was not found.
File name: "MySupport"
at MyProgram.MainProg.Main(String[] args)
=== Pre-bind state information ===
LOG: DisplayName = MySupport, Version=1.0.1874.38372, Culture=neutral,
PublicKey
Token=null
(Fully-specified)
LOG: Appbase =
G:\Projects\Testing\CSharp\TestAssemblyLoading\MyProgram\bin\Debug\
LOG: Initial PrivatePath = NULL
Calling assembly : MyProgram, Version=1.0.1874.38372, Culture=neutral,
PublicKeyToken=null.
===
........
See where the error reporting points to. MySupport.dll has been deliberately
removed from the AppBase.
Thanks for the tip anyway.
Rover
Naveen said:
Hi..
You can write a log file where it can be dumped...else popup a message box
to catch those...
This link might help you
further...
http://www.codeproject.com/dotnet/unhandledexceptions.asp
With Best Regards
Naveen K S
:
Hi,
I have a simple C# console application, say MyProgram.exe, which uses
classes from MySupport.dll.
If everything are in the same application directory, MyProgram.exe works
fine.
What I would like to know is how to handle, in my program, gracefully
when
MySupport.dll is not there?
In a VS development environment, it triggers the JIT debugging. If a
debugger is not selected, it then dump the exception to console.
Any suggestion?
Rover