Original Post
This came up in another thread, but I think it perhaps best to split off into its own discussion. I personally think that it's quite unfortunate that .NET library classes can throw exceptions as part of their Dispose method. None of the examples I can think of provide any useful data other than something didn't close cleanly. I also think that it should pretty much be avoided as a best practice.
So, are there good examples of disposable objects that have dispose failure conditions that are recoverable? A buffered stream was offered in the other thread (if the buffer can't be flushed), though that's not particularly compelling.
Or am I just carrying over the 'don't throw from destructors' best practice from C++ too far?
So, are there good examples of disposable objects that have dispose failure conditions that are recoverable? A buffered stream was offered in the other thread (if the buffer can't be flushed), though that's not particularly compelling.
Or am I just carrying over the 'don't throw from destructors' best practice from C++ too far?