Killing COM object from C#

Posted by Pradeep on Stack Overflow See other posts from Stack Overflow or by Pradeep
Published on 2010-06-15T06:14:30Z Indexed on 2010/06/15 6:22 UTC
Read the original article Hit count: 276

Filed under:

I have a COM object that we are calling from C#. This works great, and I have my own pool of objects that I can use whenever I want. Now I need to kill the object. I've tried releasing the COM object explicitly and then garbage collecting from another thread, but that does nothing. Does anyone have any other ideas to kill this object? Thanks for the help.

I've tried

System.Runtime.InteropServices.Marshal.ReleaseComObject(myApp); 
GC.Collect(); 
GC.WaitForPendingFinalizers ();
myApp = null;

and I create it by

myApplication.ApplicationClass myApp = new myApplication.ApplicationClass();

Thanks, Pradeep

© Stack Overflow or respective owner

Related posts about c#