如何在Windows上禁用调试断言对话框? [英] How can I disable the debug assertion dialog on Windows?
问题描述
我有一堆单元测试,我在批处理模式下运行。偶尔,一个将与从Visual C ++库发出的调试断言崩溃。这会导致一个对话框弹出,单元测试停止运行,直到我单击确定关闭对话框。
如何使一个C ++程序只是崩溃当你打开一个断言,而不是弹出恼人的对话框?
注意:我不想禁用断言;
查看_CrtSetReportHook http://msdn.microsoft.com/en-us/library/0yysf5e6.aspx
MSDN通告这是应用程序处理CRT运行时故障(如断言)的强大方法。大概你可以定义一个转储你的过程的报告钩子:
I have a bunch of unit tests that I'm running in batch mode. Occasionally, one will crash with a debug assertion fired from the Visual C++ library. This causes a dialog to pop up, and the unit tests stop running until I click "OK" to close the dialog.
How can I make a C++ program just crash (like on Linux) when it hits an assertion, instead of popping up the annoying dialog?
Note: I do not want to disable assertions; just the dialog.
Check out _CrtSetReportHook():
http://msdn.microsoft.com/en-us/library/0yysf5e6.aspx
MSDN advertises this as a robust way for an application to handle CRT runtime failures like assertions. Presumably you can define a report hook that dumps your process:
How to create minidump for my process when it crashes?
这篇关于如何在Windows上禁用调试断言对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!