Is that really true that in an in-proc C# assembly the Finalize methods are not called when COM objects are destroyed from the caller? And if so, is there any solution for this problem? Or the only one is to define a "Cleanup()" method and tell all users to call it and hope they will? I'm using .NET 2.0 and the C# DLL is called from a .vbs file (WSH) (and it's called with a help of a DLL Surrogate, because I want it to be available via DCOM)
I am calling Marshal.ReleaseComObject every time finished using a com object from a method call, usually in a finally block to avoid leaking COM objects when an exception is thrown. -- Sheng Jiang Microsoft MVP in VC++ wrote in message news:1184935575.408346.310420@k79g2000hse.googlegroups.com... > Is that really true that in an in-proc C# assembly the Finalize > methods are not called when COM objects are destroyed from the caller? > And if so, is there any solution for this problem? Or the only one is > to define a "Cleanup()" method and tell all users to call it and hope > they will? > > I'm using .NET 2.0 and the C# DLL is called from a .vbs file (WSH) > (and it's called with a help of a DLL Surrogate, because I want it to > be available via DCOM) >