private void ApplicationUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { EmailLogProvider.Log(e.ExceptionObject); if (System.Diagnostics.Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger System.Diagnostics.Debugger.Break(); } }