Missing guidance on disposable objects

Dec 10, 2009 at 3:30 PM

There seems to be no documentation or guidance for neither adapter writers or API users about consuming IDisposable objects. Some questions I have about this:

Should users never dispose objects and should the adapter or underlying DI framework dispose objects (perhaps impossible) or should users always dispose the object and should the adapter, framework or user supplied configuration make sure that disposing a singleton object is of no harm? Or should configuring and returning objects implementing IDisposable be avoided at all cost?

And perhaps there are other constructs expose the same type of problems.

I believe it’s important to have guidance on this. A lack of guidance could lead to problems when users try to switch from D.I. implementation. It could lead to subtle bugs and performance problems.

I like to hear your opinion on this matter.