Can the "Application Error" dialog box be disabled?
Solution 1
- Use "Disable error reporting", as Mr. Gently suggests. See also this PC World article.
- If you happen to have MS Visual Studio on your build machine, it will catch Application Errors and pop up a dialog box. To disable these dialogs (and also the Just-In-Time Debugging feature of Visual Studio), run the command
drwtsn32.exe -i
to set Dr. Watson as the default system debugger. Dr. Watson will generate a core dump and silently exit. (See this Microsoft Knowledge Base article: http://support.microsoft.com/kb/q121434/.)
Solution 2
You can also do something like this programaticaly using SetErrorMode. See this article for more details.
A simple example of how to use it is to do the following:
SetErrorMode(GetErrorMode () | SEM_NOGPFAULTERRORBOX);
The above 'ORs' the current mode with our desired addition.
Solution 3
In addition to what rkb said, if you are running Windows XP 64bit, there are two sets of values. The ones in the usual registry location and the ones under the Wow6432Node
key in HKLM
. In order to update both, run drwtsn32.exe -i
from both %SYSTEMROOT%\system32
and %SYSTEMROOT%\SysWOW64
.
Solution 4
You can use the various _CrtSetReport functions to control the way the C/C++ runtime responds to various errors (_CrtSetReportHook, _CrtSetReportMode, _CrtSetReportFile, _CrtSetReportHook2)
Solution 5
Disable error reporting via:
- Registry editing -- add your application to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHealth\ErrorReporting\ExclusionList, OR
- Right-Click on My Computer, go to the Advanced Tab, and choose the "Disable error reporting" option, OR
- You can navigate to the services console in Administrative tools, find the Error Reporting Service, go into properties and disable it
matt87m2
Every time I try to do something other than programming, I always find a way to write some code anyway. So I've given up and gone pro.
Updated on June 03, 2022Comments
-
matt87m2 almost 2 years
I am using Hudson as a continuous integration server to test C/C++ code. Unfortunatly, I have a bug somewhere that causes memory corruption, so on some Windows machines I will sometimes get a "Application Error" dialog box explaining that an instruction referenced memory that could not be read. This dialog box pops up and basically hangs the test run, as it requires manual intervention.
Is there a way to prevent this dialog box from appearing, so that the test run simply fails and is reported as such in Hudson?
Is it possible to automatically generate a minidump instead of showing the dialog?
-
matt87m2 about 15 yearsTry/catch cannot catch an invalid memory access, as far as I know.
-
matt87m2 about 15 yearsThanks! Restoring the Dr. Watson configuration and setting it not to prompt was just what I was looking for!
-
Sam Liao about 15 yearsOn a similar vein, I think it's important to call "_set_abort_behavior( 0, _WRITE_ABORT_MSG);", incase in the future your application fails because someone calls "abort()" (default behaviour for an uncaught C++ exception in Debug builds IIRC).
-
ChrisV almost 15 years__try / __except can, however.
-
skyking over 8 yearsThe PC World article seem to be empty. Consequently the first alternative doesn't provide any useful answer.