I need to explicitly Release some COM-objects that hold on to some precious resources. Unfortunately these objects doesn't provide a Close method.
I have found Marshall.ReleaseComObject(), that will release the object for most RCW-objects. The bad news is that ReleaseComObject() will not work on the IEnumerator-interface that is wrapped around IEnumXXXX. It appears the the RCW IEnumerator is implemented by EnumeratorViewOfEnumVariant, that in turn holds a reference to the IEnumXXX in its private m_pEnumVariantObj member. And since EnumeratorViewOfEnumVariant inaccessible to my code, I have dangling resources. Setting all my references to null and calling GC.Collect(); does not seem to help either. The COM-library I am using is Visual SourceSafe Automation, and the troublesome COM-object is VSSVersions, which there can be only one instance of. -- Rune Huseby You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.