问题描述
当Windows上的应用程序崩溃并且安装了调试器(例如Visual Studio)时,将出现以下模式对话框:
When an application crashes on Windows and a debugger such as Visual Studio is installed the following modal dialog appears:
X停止工作
问题导致程序停止
正常工作。 Windows将关闭
程序并通知您
解决方案是否可用。
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]
[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.
四处寻找我认为我已经找到了在Windows XP上禁用此功能的解决方案,这是在破坏此注册表项:
Searching around I think I've located the solution for disabling this on Windows XP, which is nuking this reg key:
但是,这在Windows Vista上不起作用。
However, that did not work on Windows Vista.
推荐答案
要强制Windows错误报告(WER)进行崩溃转储并关闭应用程序,而不是提示您调试程序,可以设置以下注册表项:
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
设置后,当您的应用崩溃时,您应该会看到* .hdm p和* .mdmp文件,位于:
After this is set, when your apps crash, you should see *.hdmp and *.mdmp files in:
%ALLUSERSPROFILE%\Microsoft\Windows\WER\
这篇关于如何在Windows Vista上禁用“调试/关闭应用程序”对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!