Home All Groups Group Topic Archive Search About
Author
26 Apr 2006 12:03 PM
Vigj
Hi
I'm developing a com object (later used by a mfc c++ application) in C#. The
result is a dll that the C++ application loads and from which istantiates
forms, objects etc etc
sometimes C# code throws an exception and c++ code gets killed.

My question is very simple: is there a way to set in my C# dll a global
exception handler so to avoid that the excpetions can "leave" managed code
and cause problems with unmanaged code? I would like to avoid to decorate
every of my method with a try..catch


I tried, as suggested by Yoga Weazel, to assign an handler to
AppDomain.CurrentDomain.UnhandledException as soon as the com object
developed in C# is instantiated but this does not seem to work.

By the way, using the debugger, I found that  AppDomain.CurrentDomain seems
to refer to the native c++  application, not to my dll.

Any suggestion?

Thanks a lot

Vigj

AddThis Social Bookmark Button