How do you catch unhandled exceptions in C # .net when code is triggered by a COM call?

How do you catch unhandled exceptions in C # .net when code is triggered by a COM call?

I tried to subscribe to the unhandled exception event like this:

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException);

      

But I think the code called from COM is loaded into Process Address Space instead of AppDomain. So I am assuming that the current application domain is not within the confines of my C # application, but rather in the calling external EXE file (which is not in .NET language).

I am trying to catch (and log) exceptions before reaching the calling EXE in order to provide better error information. Right now I'm just getting the message "External function call failed".

Update: Please note that we are using the event to catch the HandleProcessCorruptedStateExceptionsAttribute, so adding more try / catch doesn't help.

+3
c # com unhandled-exception


source to share


No one has answered this question yet

Check out similar questions:

1743
What's the best way to give a C # auto property an initial value?
412
Why catch and reverse engineer an exception in C #?
132
How to handle AccessViolationException
8
How can I debug an unhandled exception in managed code when called from COM?
five
Unhandled exceptions in C # class library for logging purposes
five
catching unhandled exceptions in .NET excel addins (XLL)?
3
How to raise an exception from C # .NET COM
3
.NET COM Interop & # 8594; Global Exception Handler
1
Catch All (handled or unhandled) Exceptions
0
Unhandled exception in thread thrown by third party dll -.net



All Articles
Loading...
X
Show
Funny
Dev
Pics