K
Ken
I'm trying to install an UnhandledException handler in a Console
application. I have done the following as the first few lines of code in
Main:
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new
UnhandledExceptionEventHandler(HandleTheException);
Then my handler is defined:
public static void HandleTheException ( object sender,
UnhandledExceptionEventArgs e )
{
Console.WriteLine ( "Exception: {0}",
(Exception)e.ExceptionObject).Message );
Console.ReadLine ( );
}
When an UnhandledException is thrown and I have the JIT debbugging options
all UN checked I still get a dialog that has "Common Language Runtime
Debugging Services" in the title bar and a message saying that the
application has generated an exception that could not be handled. Click OK
to terminate that application or Click CANCEL to debug the application. If
I click OK then my handler gets invoked.
Is there any way to disable this dialog box? I just want my handler to do
all the work with no other dialogs.
Thanks
Ken
application. I have done the following as the first few lines of code in
Main:
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new
UnhandledExceptionEventHandler(HandleTheException);
Then my handler is defined:
public static void HandleTheException ( object sender,
UnhandledExceptionEventArgs e )
{
Console.WriteLine ( "Exception: {0}",
(Exception)e.ExceptionObject).Message );
Console.ReadLine ( );
}
When an UnhandledException is thrown and I have the JIT debbugging options
all UN checked I still get a dialog that has "Common Language Runtime
Debugging Services" in the title bar and a message saying that the
application has generated an exception that could not be handled. Click OK
to terminate that application or Click CANCEL to debug the application. If
I click OK then my handler gets invoked.
Is there any way to disable this dialog box? I just want my handler to do
all the work with no other dialogs.
Thanks
Ken