views:

804

answers:

5

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
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
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 ); }

+6  A: 
Marcus Griep
+2  A: 

There is a R# plug-in that analyses thrown exceptions. http://exceptionalplugin.codeplex.com/