Preventing "[YourProgramName] Stopped Working" dialog with unhandled exceptions

I have a WinForm application with some external library dependencies that can sometimes throw an exception outside the context of running threads. As of now, this is quite normal behavior (well, of course, an exception), and we threw AppDomain.CurrentDomain.UnhandledException to just restart the program.

The only problem is that [your program] has stopped working as shown below: alt text http://telcontar.net/store/archive/CrashGallery/images/crash/vista/2007-05-30%20Microsoft%20Register% 20Server.png

Is there a way to prevent this dialog box from appearing at all, be it in the AppDomain's unhandled exception handler or in the configuration settings, since no end users will read it, and it just grabs the resources until it is clicked.

+7
exception winforms dialog
source share
1 answer

Avoid the WER dialog by preventing the UnhandledException event handler from exiting. Call Environment.Exit () to terminate your application.

+4
source share

All Articles