Project Description

This is a plugin for great ReSharper product. The main purpose for that plugin is to aid developers to analyse thrown exceptions and provide some guidance about them. It introduces the notion of checked exception that you may know from Java to C#.

Motivation

Working with a code base (whether it is a small one or a big one) I constantly encounter issues caused by wrong exception handling. You may have a super exception handling policy, but it is the developer who must execute this policy on it's own code. You may have automatic policy checking but again it is the developer who will have to fix those violations. Even with no policy defined there are good practices on how to properly handle exceptions. This Exceptional plug-in will allow you to seamlessly apply these good practices right into your code base with couple of key strokes.
Generally we should document our public API and I consider thrown exceptions documentation important. But even if documenting thrown exceptions is pretty easy the maintenance of the code that is using a particular method is not. While developing our functionality we use methods and properties on classes from other modules or core .Net Framework components. If they are documented properly we can see in intellisense that they throw exceptions or not. We can then take it into account. But then after a month or two when other team member will update the method that we are relying on and throw another exception we will not be warned. Here Exceptional plug-in comes into the game. He will analyze call sites and provide hints on exceptions thrown from that invocations. If you catch them or have them documented in your method that's fine. But if you miss something you will be proposed to either catch that exception or document it as thrown.

Features

Analyze exceptions thrown from method or property (only public, protected or internal).

Exceptions thrown outside the scope of method\property that are not documented in methods xml documentation (thrown with use of throw keyword).
throw.analysis.tooltip.png

Fix: Document or catch thrown exception.
throw.analysis.quickfix.png

Exceptions thrown outside the scope of method\property that are not documented in methods xml documentation (thrown from another invocation).
method.invocation.analysis.tooltip.png

Fix: Document or catch thrown exception.
method.invocation.analysis.quickfix.png

Exceptions documented in xml documentation that are not thrown from method/property.
documentation.analysis.tooltip.png

Fix: Remove documentation of not thrown exception.
documentation.analysis.quickfix.png

Analyze catch clauses

General catch-all clauses should be avoided.
catchall.clause.analysis.tooltip.png

Throwing new exception from catch clause should include message and inner exception.
inner.exception.analysis.tooltip.png

Fix: Include inner exception from outer catch clause.
inner.exception.analysis.quickfix.png


More features to come!

Last edited Mar 22, 2009 at 11:20 PM by nuwanda, version 24