本文介绍了如何在程序崩溃时出现异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个程序定期崩溃,但我不知道为什么。我以调试模式运行,但没有弹出。该程序刚刚退出。我已经有其他错误,抛出异常...但不是这一个。是否有一种奇妙的方法来捕捉它或某些东西?

One of my programs crashes periodically, but I don't know why. I'm running it in debug mode, but nothing pops up. The program just suddenly exits. I've had other bugs that do throw an exception...but not this one. Is there a magical way of catching it or something?

推荐答案

大概你在Visual Studio中运行它,由于某种原因它不是停止在调试器中有一个未捕获的异常,在这种情况下,您可以尝试从Visual Studio外部捕获崩溃。请参阅的回答,特别是。从Visual Studio外部启动您的可执行文件,然后运行:

If it only crashes periodically, but within a reasonably short period of time, start with Sysinternals procdump. Start your executable from outside Visual Studio, then run:

procdump -e <YourExecutableNameOrPid>

并等待它收获崩溃转储 - 假设由于未处理的异常而退出 - 然后加载崩溃转储到VS 2010或WinDbg。

and wait for it to harvest a crash dump - assuming it exits due to an unhandled exception - then load the crash dump into VS 2010 or WinDbg.

这篇关于如何在程序崩溃时出现异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 09:50
查看更多