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.
source to share
No one has answered this question yet
Check out similar questions: