UnhandledExceptionEventHandler for .NET code running inside a native application?
As far a开发者_开发知识库s I can understand, .NET offers the facility to declare an UnhandledExceptionEventHandler
in case any exceptions are thrown and not handled.
However, as far as I can follow, this only works for a .NET executable and cannot work if you have a .NET DLL that you call into from native code, e.g. Native-Exe
(e.g. C++/MFC) -> C++/CLR-DLL ->
(3rd party) C#-DLL
.
For upcalls into the C#-DLL, I have to catch all .NET exceptions in the bridge DLL and translate them appropriately.
However, what can I do about .NET GUI code or threads started by the C# DLL that throw .NET exceptions? Can I install a handler for those?
Note: This is a follow up to another question of mine where I have been asking about the GUI side of the problem. This here question is about the UnhandledExceptionEventHandler
in the context of a native app.
精彩评论