G
Guest
I'm trying to create an all encompassing error handler to handle all
Unhandled Exceptions. I have added an event handler to
AppDomain.CurrentDomain.UnhandledException and everything works fine when
debugging. When I try to run the app outside of the IDE I get the JIT Debug
message and my app never gets to the UnhandledException event. What am I
doing wrong??? Thanks in advance.
Sample code from a Windows App:
[Windows Stuff]
....
....
....
[STAThread]
static void Main()
{
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.Run(new Form1());
}
private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs e)
{
MessageBox.Show("Error!!!");
Application.Exit();
}
private void button1_Click(object sender, System.EventArgs e)
{
throw new Exception();
}
Unhandled Exceptions. I have added an event handler to
AppDomain.CurrentDomain.UnhandledException and everything works fine when
debugging. When I try to run the app outside of the IDE I get the JIT Debug
message and my app never gets to the UnhandledException event. What am I
doing wrong??? Thanks in advance.
Sample code from a Windows App:
[Windows Stuff]
....
....
....
[STAThread]
static void Main()
{
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.Run(new Form1());
}
private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs e)
{
MessageBox.Show("Error!!!");
Application.Exit();
}
private void button1_Click(object sender, System.EventArgs e)
{
throw new Exception();
}