The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ancientlore (4) [Avatar] Offline
#1
Does anyone know the technical reason why Microsoft didn't implement the IDisposable pattern for COM interop? If you want to force a COM object to be freed sooner, you need to use:

System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);

I am not 100% certain but I believe that even if you use:

delete obj;

I think the object will still be on the finalization queue because there is no Dispose() to call.

I realize you can use COM natively in C++, but since this is a book on C++/CLI and covers interop with native code, I am curious what technical reasons might exist behind the way COM interop works.