什么是“Microsoft C ++ Visual Runtime Library:Runtime error!”并且如何捕获它? [英] What is "Microsoft C++ Visual Runtime Library: Runtime error!" and how can I capture it?

查看:288
本文介绍了什么是“Microsoft C ++ Visual Runtime Library:Runtime error!”并且如何捕获它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很少收到一些用户的报告,该应用程序已经终止了以下消息框:

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.

可能导致此消息?

有没有办法更改应用程序,而不是(或附加)显示消息,生成一个minidump(或者某些其他自定义处理由应用程序完成)? / p>

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)?

推荐答案

该消息由 abort(),可以直接调用或者被设计不当的异常 - 请参阅unexpected()或terminate(),如< a href =http://stackoverflow.com/questions/1938715/disable-microsoft-visual-c-runtime-error>禁用Microsoft Visual C ++运行时错误。是否显示消息是否可以使用 _set_abort_behavior 调用。在XP及更高版本的应用程序应该默认创建一个minidump并发送到Windows错误报告服务。如果您需要自定义处理程序(例如自定义崩溃转储),则唯一(非标准)可能性似乎是为abort()函数提供自己的实现。

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.

Microsoft C运行时库中中止的默认实现如下:

The default implementation of abort in Microsoft C Runtime Library does following:


  • 显示消息框或将消息打印到控制台

  • 如果有任何

  • ,如果允许发生故障报告,则会引发SIGABRT的处理程序,然后

    • 删除任何处理程序使用SetUnhandledExceptionFilter(NULL)

    • 使用人为准备的异常信息执行UnhandledExceptionFilter

    • shows the message box or prints the message to the console
    • raises handler for SIGABRT if there is any
    • if fault reporting is allowed, then
      • deletes any handler for unhandled exceptions using SetUnhandledExceptionFilter(NULL)
      • executes UnhandledExceptionFilter with an artificially prepared exception information

      在源代码中包含以下代码使应用程序执行默认结构化异常处理(包括您可能已安装的任何过滤器):

      Including a following code in your source makes the application to perform default structured exception handling (including any filter you may have installed):

      extern "C" void __cdecl abort (void)
      {
        volatile int a = 0;
        a = 1/a;
      }
      

      这篇关于什么是“Microsoft C ++ Visual Runtime Library:Runtime error!”并且如何捕获它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆