[.net] Custom exception window for "uncatched" exceptions?

Started by
4 comments, last by RipTorn 17 years, 6 months ago
Hi! Is there a way to globally catch and display all uncatched (unexpected) exceptions, and display them in a custom window instead of the built-in one? Thanks for the answers! ;)
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
Advertisement
In a Windows Forms app, you should hook up to the Application.ThreadException event. There's also the AppDomain.UnhandledException event.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Quote:Original post by Arild Fines
In a Windows Forms app, you should hook up to the Application.ThreadException event. There's also the AppDomain.UnhandledException event.


thanks! and how can i disable the built-in exception message window?
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
Quote:Original post by orbano
Quote:Original post by Arild Fines
In a Windows Forms app, you should hook up to the Application.ThreadException event. There's also the AppDomain.UnhandledException event.


thanks! and how can i disable the built-in exception message window?


wrapping Main in a try-catch block with Exception e should do it. There's probably a better way tough.
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style
If you handle Application.ThreadException, the default exception dialog won't be shown.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Just be careful not to crash in your exception handler, or you could lose the original exception information.

I once had this happen, because I was accidentally disposing the windows forms default font.

This topic is closed to new replies.

Advertisement