lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Sayatovic <bsayato...@creditinfonet.com>
Subject RE: Implementing IDisposable / finalizer pattern to avoid index lock issues
Date Fri, 01 Jun 2012 18:41:56 GMT
The two problems I'm aware of (and, sorry, my memory is now foggy) are...

1. the "using" statement doesn't call your IDisposable's Dispose() method if an exception
is thrown inside the using's block (hence why I use try/finally).

2. The IDisposable's method will be called by the finalizer if it hasn't been disposed, but
not all finalizers are guaranteed to run when a VM is shutting down.  That may not be a problem
in this case (is it?), but in general, it's a hazard.

Regards,
Brian.

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: Nicholas Paldino [.NET/C# MVP] [mailto:casperOne@caspershouse.com]

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

Mime
View raw message