应用程序级的全局异常处理程序没有被击中 [英] application level global exception handler didn't get hit

查看:159
本文介绍了应用程序级的全局异常处理程序没有被击中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.net应用程序通过订阅AppDomain.Current.Domain UnhandledException事件具有全局异常处理程序。在几个场合,我看到我的应用程序崩溃,但这个全局异常处理程序从来没有被击中。不知道它的帮助,但应用程序是在做一些COM互操作。

My .net application has a global exception handler by subscribing to AppDomain.Current.Domain UnhandledException event. On a few occassions i have seen that my application crashes but this global exception handler never gets hit. Not sure if its help but application is doing some COM interop.

我的理解是,只要我没有任何本地捕获块吞没异常,这个全局异常处理程序应该始终被打。任何关于我可能会丢失导致此处理程序的想法从未被调用?

My understanding is that as long as I don't have any local catch blocks swallowing the exception, this global exception handler should always be hit. Any ideas on what I might be missing causing this handler never been invoked?

推荐答案

CLR不是全能的,例外,非托管代码可以导致。通常是AccessViolationException btw。当托管代码调用非托管代码时,它只能捕获它们。不受支持的情况是非托管代码使自己的线程自动运行,并且此线程导致崩溃。使用COM组件时不太可能。

The CLR is not all-powerful to catch every exception that unmanaged code can cause. Typically an AccessViolationException btw. It can only catch them when the unmanaged code is called from managed code. The scenario that's not supported is the unmanaged code spinning up its own thread and this thread causing a crash. Not terribly unlikely when you work with a COM component.

由于.NET 4.0,致命执行引擎异常不再导致UnhandledException事件触发。这个例外被认为太令人讨厌,不允许任何更多的托管代码运行。它是。传统上,StackOverflowException会立即中止。

Since .NET 4.0, a Fatal Execution Engine exception no longer causes the UnhandledException event to fire. The exception was deemed too nasty to allow any more managed code to run. It is. And traditionally, a StackOverflowException causes an immediate abort.

您可以从进程的ExitCode进行某些诊断。它包含终止进程的异常异常代码。 0x8013yyyy是托管代码引起的异常。 0xc0000005是访问冲突。等等。您可以使用adplus,可从Windows调试工具下载,以捕获该过程的小数据库。由于这可能是由COM组件引起的,与供应商合作可能对解决这个问题很重要。

You can diagnose this somewhat from the ExitCode of the process. It contains the exception code of the exception that terminated the process. 0x8013yyyy is an exception caused by managed code. 0xc0000005 is an access violation. Etcetera. You can use adplus, available from the Debugging Tools For Windows download to capture a minidump of the process. Since this is likely to be caused by the COM component, working with the vendor is likely to be important to get this resolved.

这篇关于应用程序级的全局异常处理程序没有被击中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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