Search code examples
windowstestingwindows-vistacrash-reportswindows-error-reporting

How do I disable the 'Debug / Close Application' dialog on Windows Vista?


When an application crashes on Windows and a debugger such as Visual Studio is installed the following modal dialog appears:

[Title: Microsoft Windows]

X has stopped working

A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

[Debug][Close Application]

Is there a way to disable this dialog? That is, have the program just crash and burn silently?

My scenario is that I would like to run several automated tests, some of which will crash due to bugs in the application under test. I don't want these dialogs stalling the automation run.

Searching around I think I've located the solution for disabling this on Windows XP, which is nuking this reg key:

HKLM\Software\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger

However, that did not work on Windows Vista.


Solution

  • To force Windows Error Reporting (WER) to take a crash dump and close the app, instead of prompting you to debug the program, you can set these registry entries:

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting]
    "ForceQueue"=dword:00000001
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\Consent]
    "DefaultConsent"=dword:00000001
    

    After this is set, when your apps crash, you should see *.hdmp and *.mdmp files in:

    %ALLUSERSPROFILE%\Microsoft\Windows\WER\