VS 2010 code analyzer's and FxCop? (not sure) Reliability Rules will do a pretty good job on detecting if there exists execution paths in the analyized code where objects implementing IDisposable
are going out of scope without calling Dispsoe()
(it is overeager and will in many ocasions detect false positives).
This will of course not enforce the using
construct as a correctly implemented try-finally
block will pass the test (both are obviously equivalent under the hood, so I'm not sure if thats an issue).
EDIT: FX Cop does not support this warning. Its availabe since VS 2005 code analyzer.