2

Possible Duplicate:
Can Resharper be set to warn if IDisposable not handled correctly?

Is there a way to create a rule for resharper that underlines an object that implements IDisposable but doesn't call Dispose() (or using) at any point within the method?

For example, ClassA implements IDisposable. I new up an instance of ClassA, but I didn't think to check it for IDisposable or Dispose() (I dunno, maybe I was moving too fast, shame on me, but this is part of resharper's purpose, real time code review). Resharper inspects the object and sees that it either implements IDisposable or contains a method called Dispose(). It then looks within the containing method to see if .Dispose() is ever called, or if the declaration is inside a using construct. If not, then it underlines the declaration, making me feel like the Gibson just crashed.

I've seen this come up a number of times in other threads, but most of them seem to be at least 3 years old, inconclusive, etc. I would be happy even with just changing the highlight color of a type for classes that implement it, just to remind me.

TIA

Community
  • 1
  • 1
Sinaesthetic
  • 11,426
  • 28
  • 107
  • 176

0 Answers0