Closed cuft closed 1 year ago
This was actually the code I expressly removed from the original implementation. After a lot of testing, I found that ComReleaser
is really quite unnecessary. Very regularly, .NET released the COM object before this Dispose
method was even called which resulted in a memory exception.
Interesting... However, i.e. IPropSetStorageTest
fails without ReleaseComObject
after writing. It returns STG_E_ACCESSDENIED on the reading trial.
Couldn't the memory issues be caused by multiple Dispose
calls? An already disposed check would help then.
For me, the problem was caused when the interface was dereferenced/released external to ComReleaser
. And, unfortunately, determining when that happened was not consistent. In my code, I go old-school and manually control references rather than betting on a disposal pattern. If I could find a way to prevent crashes, my preference would be to call FinalReleaseComObject
in a dispose pattern.
It seems it was just missing here...