什么是“Microsoft C” Visual Runtime Library:运行时错误!”我怎样才能捕捉到它?
我很少收到一些用户的报告,称应用程序已自行终止,并显示以下消息框:
Microsoft C++ Visual Runtime Library Runtime error! Program: XXXXX.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
不幸的是,应用程序在显示消息后静默终止。我们对结构化异常生成了故障转储,但由于此处没有异常,因此不会生成故障转储。
是什么原因导致此消息?
是否有某种方法可以更改应用程序,以便代替(或附加)显示消息,生成小型转储(或由应用程序完成一些其他自定义处理)?
Seldom I receive a report from some user that the application has terminated itself with a following message box:
Microsoft C++ Visual Runtime Library Runtime error! Program: XXXXX.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
Unfortunately the application terminates silenly after showing the message. We have a crash dump generation on structured exceptions, but as there is no exception here, no crash dump is generated.
What can be causing this message?
Is there some way to change the application so that instead of (or in addtion to) showing the message a minidump is generated (or some other custom handling is done by the application)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该消息由 abort() 生成,它可以直接调用,也可以通过设计不当的异常调用 - 请参阅意外()或终止(),如禁用 Microsoft Visual C++ 运行时错误。是否显示消息可以使用 进行调整_set_abort_behavior 调用。在 XP 及更高版本上,应用程序应默认创建小型转储并将其发送到 Windows 错误报告服务。如果您需要自定义处理程序(例如自定义故障转储),唯一(非标准)的可能性似乎是为 abort() 函数提供您自己的实现。
Microsoft C 运行时库中中止的默认实现执行以下操作:
在源代码中包含以下代码使应用程序执行默认的结构化异常处理(包括您可能安装的任何过滤器):
The message is produced by abort(), which can be called either directly, or by badly designed exceptions - see unexpected() or terminate(), as described in Disable Microsoft Visual C++ Runtime Error. Whether the message is shown or not can be adjusted using _set_abort_behavior call. On XP and later the application should create a minidump by default and send it to Windows Error Reporting service. If you need a custom handler (e.g. custom crash dump), the only (non-standard) possibility seems to be to provide your own implementation for the abort() function.
The default implementation of abort in Microsoft C Runtime Library does following:
Including a following code in your source makes the application to perform default structured exception handling (including any filter you may have installed):
应用程序调用
abort()
很可能是因为在堆栈展开期间异常逃逸析构函数后调用了terminate()
,或者因为未调用异常。请参阅答案此相关问题了解详细信息。基本上,您必须在顶层捕获并处理所有异常,而不是让异常逃脱析构函数。在调试器下启动程序并启用“抛出异常时停止”以查找内部到底出了什么问题并修复它。
The application has called
abort()
most likely becauseterminate()
has been called after an exception has escaped a destructor during stack unwinding or because an exception was not called.See an answer to this related question for details. Basically you have to catch and handle all exceptions at the top level, not let exceptions escape destructors. Start your program under debugger and enable "Stop when exception is thrown" to find what exactly is going wrong inside and fix that.