FxCop/Code Analysis will also tell you if you are using the Dispose pattern 
incorrectly.

From: [email protected] [mailto:[email protected]] On 
Behalf Of Greg Keogh
Sent: Tuesday, April 13, 2010 4:56 PM
To: 'ozDotNet'
Subject: RE: Dispose surprise

If so, Dispose() should be calling GC.SuppressFinalize(this) to prevent 
finalization.

D'OH! I forgot. I've got disposable class all over the place, and for some 
stupid reason I forgot to SuppressFinalize in this class. The symptom is 
obvious now that I look at it again (I should have started so early this 
morning).

And you're also right ... a finalizer is probably not needed for a class that 
doesn't hold unmanaged resources. The Framework Design Guidelines book 
discusses the finalizer, so I'd better read that again to be clear about 
exactly when one is needed.

Thanks
Greg

Reply via email to