Global Exception Handling in C#

by Mark Milec 4/7/2008 9:10:00 AM

I've been using the Application_Error event in ASP.NET as a global exception handler for a while.  While looking for a way to implement something similar for Windows Forms I found this post: http://blogs.msdn.com/tom_krueger/archive/2005/02/17/375602.aspx   explaining how to use Application.ThreadException to do just that.

I then found out that Application.ThreadException is not available in the .net Compact Framework but as explained here: http://www.danielmoth.com/Blog/2004/12/appdomainunhandledexception-part-1.html, AppDomain.CurrentDomain.UnhandledException can be used to accomplish the same thing.

There are some problems with using AppDomain.CurrentDomain.UnhandledException as explained here: http://www.codinghorror.com/blog/archives/000201.html

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

8/20/2008 2:18:28 PM

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

Name of author Mark Milec
Senior Application Developer at Atlas Tube

View Mark Milec's profile on LinkedIn E-mail me Send mail

Calendar

<<  August 2008  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Don't show

    Archive

    Authors

    Categories

    None


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in