捕获非托管第三方DLL的异常 [英] catch exception of unmanaged 3rd party dll

查看:138
本文介绍了捕获非托管第三方DLL的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的WPF应用程序中,我正在使用一个非托管的第三方dll。

In my WPF-Application I am making use of a unmanaged 3rd Party dll.

这个dll正在抛出一个我还没有完成捕捉的重复。

我的应用程序崩溃弹出一个对话框"< application>不再有效了"  (翻译所以可能不准确)。在该对话框中,指出了所讨论的dll以及异常代码"c0000005"。我认为
是违反访问权限。

This dll is throwing a excpetion which I have not yet accomplished to catch.
My application crashes popping up with a dialog "<application> is not working any more"  (translated so probably not exact). With in this dialog the dll in question is pointed out as well as the exception code "c0000005" which I assume is a access violation.

我在自定义广告中使用dll - >任务 - >发生崩溃的那一刻。

I am using the dll in a Custom-Tread -> Task -> at the moment the crash happens .


  1. 我已经尝试过:

    申请x:Class ="< myApp>"

                 DispatcherUnhandledException = QUOT; App_OnDispatcherUnhandledException">


  2. 从任务中发生异常:

    AppDomain.CurrentDomain.UnhandledException + =(sender,args)= > ....;

所有这些都无法捕获异常: - (

All of this was not able to catch the exception :-(

对于我的应用程序来说,这是至关重要的,没有未处理的异常发生。我有没有机会获得这些例外?请帮助!

For my application it is crucial, that no unhandled exceptions occure. Is there any chance for me to get hold of such exceptions? Please Help!

问候

Rainer

Regards
Rainer

推荐答案

永远不应该捕获访问冲突异常,它们表示错误代码和那些错误应该修复。

Access violation exceptions should never be caught, they indicate bugs in the code and those bugs should be fixed.

如果你不能让第三方修复他们的dll,如果你确定不会因为你的滥用而发生异常然后,您可以告诉运行时允许在给定方法中捕获此类异常:

If you can't get the 3rd party to fix their dll and if you are sure that the exception doesn't happen as a result of you misusing the dll then you can tell the runtime to allow catching of such exceptions in a given method:

http://msdn.microsoft.com/en-us/library/system.runtime.exceptionservices.handleprocesscorruptedstateexceptionsattribute(v=vs.110)。 ASPX

或全球:

http://msdn.microsoft.com/en-us/library/dd638517(v = vs.110).aspx

< a href ="http://msdn.microsoft.com/en-us/library/dd638517(v=vs.110).aspx">


这篇关于捕获非托管第三方DLL的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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