public void SetupGlobalExceptionHandler() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); AppDomain.CurrentDomain.ProcessExit += currentDomain_ProcessExit; }