Java requires that you catch all possible exceptions or declare them as thrown in the method signature. This isn't the case with C# but I still feel that it is a good practice to catch all exceptions. Does anybody know of a tool which can process a C# project and point out places where an exception is thrown but not caught?
+2
A:
Red-Gate software has a product called Exception Hunter which should do that.
Mitchel Sellers
2008-10-24 02:54:34
A:
If you are using C# for a web application then you can use ELMAH which shows a list of all the handled and unhandled exceptions.
Just download ELMAH and plug it in. It is FREE!
azamsharp
2008-10-24 03:03:10
A:
Don't catch them in individual methods, unless you need to, setup a global handler.
Application.ThreadException += new ThreadExceptionEventHandler( Application_ThreadException );
private static void Application_ThreadException( object sender, ThreadExceptionEventArgs e) { dispatchException( e.Exception ); }