This is related to a previous question.
What I\'m trying to understand now is how come UI thread exceptions can be prevented from terminating the application while non-U
Does this help at all?
Improved Unhandled Exception behavior in .NET 2.0
Also, this code seems to "die quietly". Are you looking for something else?
using System;
namespace UnhandledException
{
class Program
{
static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
throw new NotImplementedException();
}
static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception exception = (Exception)e.ExceptionObject;
System.Console.WriteLine("exception=[" + exception.ToString() + "]");
Environment.Exit(-1);
}
}
}