Would you clarify the statement "My understanding is IDisposable is wrought with trouble?"
Perhaps the implementations are, or the usages are (the client doesn't call Dispose, but that same case exists with the current Close method). I ask because I've seen a number of discussions (on this list and off) around IDisposable that make unqualified statements like that which don't really point out any problems with IDisposable (or other .NET-specific features). - Nick On Jun 1, 2012, at 1:44 PM, "Brian Sayatovic" <bsayato...@creditinfonet.com<mailto:bsayato...@creditinfonet.com>> wrote: I use a try/finally myself, with some extension methods to wrap it. My understanding is that IDisposable is wrought with trouble. My Lucene access is wrapped in an agent class, and my syntax ends up looking like DoWithAgent(agent => agent.UpdateIndex(foo)); Brian Sayatovic Senior Software Architect 866-218-1003 toll-free ext. 8936 937-235-8936 office 4540 Honeywell Ct. Dayton, OH 45424 This message may contain confidential/proprietary information from the CINgroup or its subsidiaries. If you are not an intended recipient, please refrain from the disclosure, copying, distribution or use of this information. All such unauthorized actions are strictly prohibited. If you have received this transmission in error, please notify the sender by e-mail and delete all copies of this material from any computer. -----Original Message----- From: Kohlhepp, Justin W (Heritage Holdings (HHI)) [mailto:justin.kohlh...@thehartford.com] I was surprised to notice that IndexWriter does not implement IDisposable. It seems that the user is responsible for guaranteeing that IndexWriter.Close is called and that IndexWriter itself does not do this in a Dispose or destructor method. Do I have this understanding correct? I wrote a wrapper around Lucene.NET<http://Lucene.NET> for my application and was forced to implement IDisposable / finalizer in order for index to unlock correctly. Is this the expected pattern?