Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / May 2006

Tip: Looking for answers? Try searching our database.

exception handling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vigj - 19 Apr 2006 13:59 GMT
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

thanks in advance!
yoga weazel - 19 Apr 2006 17:25 GMT
Check out AppDomain UnhandledExceptionHandler delegates
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fSystemUnhandledExceptionEventHandlerClassTopic.asp
)

> Hi
> I'm developing a com object (later used by a mfc c++ application) in C#. The
[quoted text clipped - 8 lines]
>
> thanks in advance!
Vigj - 24 Apr 2006 08:52 GMT
I tries but it does not seem to work.
looking with the debugger the value of AppDomain.CurrentDomain refers to the
Win32 c++ app...
I set the eventhandler but it is not called when an exception is thrown...

Any suggestions?

> Check out AppDomain UnhandledExceptionHandler delegates
> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fSystemUnhandledExceptionEventHandlerClassTopic.asp
)
[quoted text clipped - 11 lines]
> >
> > thanks in advance!
Vigj - 15 May 2006 16:11 GMT
at the end it  worked setting
Application.ThreadException from the C# dll

> Check out AppDomain UnhandledExceptionHandler delegates
> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fSystemUnhandledExceptionEventHandlerClassTopic.asp
)
[quoted text clipped - 11 lines]
> >
> > thanks in advance!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.