A
Ayende Rahien
The following first throws the nasty exception dialog, and only then show me
the message.
Is there a way to avoid this?
This occur both inside & outside VS.
public class Test
{
private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs e)
{
System.Windows.Forms.MessageBox.Show(((Exception)e.ExceptionObject).Message)
;
}
private static void Application_ThreadException(object sender,
System.Threading.ThreadExceptionEventArgs e)
{
System.Windows.Forms.MessageBox.Show(e.Exception.Message);
}
[ STAThread()]
public static void Main(string [] args)
{
System.AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
System.Windows.Forms.Application.ThreadException += new
System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Test();
}
private static void Test()
{
throw new InvalidOperationException("Test");
}
}
}
the message.
Is there a way to avoid this?
This occur both inside & outside VS.
public class Test
{
private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs e)
{
System.Windows.Forms.MessageBox.Show(((Exception)e.ExceptionObject).Message)
;
}
private static void Application_ThreadException(object sender,
System.Threading.ThreadExceptionEventArgs e)
{
System.Windows.Forms.MessageBox.Show(e.Exception.Message);
}
[ STAThread()]
public static void Main(string [] args)
{
System.AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
System.Windows.Forms.Application.ThreadException += new
System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Test();
}
private static void Test()
{
throw new InvalidOperationException("Test");
}
}
}