如何拥有一个全球性的异常处理DLL在C#?全球性、异常、DLL

由网友(碧海蓝天钻戒白婚纱我的他)分享简介:DLL在C#中没有入口点,所以我需要把code全局异常处理在一个地方,因为这些DLL是在exe文件引用,都没有试图追赶,但也有因为一些错误,它崩溃,并确定我们正在努力创造一个崩溃转储。任何人都可以建议是它做了可行的解决方案,或其他任何东西有许多工作要做。Dll has no entry point in C#, s...

DLL在C#中没有入口点,所以我需要把code全局异常处理在一个地方,因为这些DLL是在exe文件引用,都没有试图追赶,但也有因为一些错误,它崩溃,并确定我们正在努力创造一个崩溃转储。任何人都可以建议是它做了可行的解决方案,或其他任何东西有许多工作要做。

Dll has no entry point in C#, so i need to put the code for global exception handling in one place as these dlls are referenced in exe and all have there try catch but there are some errors due to which it is crashing and to identify we are trying to create a crash dump. Can anyone suggest is it the feasible solution to do that or anything else has to be done.

感谢。

推荐答案

由于科迪说你应该附上每次调用该DLL在try catch块来处理异常。你的说法是有点混乱,我假设你已经在使用try catch块。如果是这样的话,你可以处理全球性的异常,以及以确保它不是EXE本身抛出异常。

As Cody said you should enclose every call to that dll in a try catch block to handle the exception. Your statement is a bit confusing I am assuming you are already using try catch block. If that's the case you can handle global exceptions as well to make sure it's not the exe itself throwing exception.

例如在Win Form应用程序可以处理的 Application.ThreadException 赶上全球例外。您也可以尝试与处理 AppDomain.Unhandled 事件

For example in Win Form application you can handle Application.ThreadException to catch global exceptions. You can also try with handling AppDomain.Unhandled event

阅读全文

相关推荐

最新文章