Releasing late binding COM object in C#
-
I have a C# program that uses a COM object in late binding: Type DllObj; object ClsObj; DllObj = Type.GetTypeFromProgID("MyDLL.MyClass"); ClsObj = Activator.CreateInstance(DllObj); My problem is that after the call is returned, the DLL MyDLL.DLL is stil in memory. I can see it using the Process Explorer utility. How can I release that DLL? My original code used early binding, and I released the COM object after using it by calling System.Runtime.InteropServices.Marshal.ReleaseComObject(). It does not seem to work when I pass it the ClsObj.
-
I have a C# program that uses a COM object in late binding: Type DllObj; object ClsObj; DllObj = Type.GetTypeFromProgID("MyDLL.MyClass"); ClsObj = Activator.CreateInstance(DllObj); My problem is that after the call is returned, the DLL MyDLL.DLL is stil in memory. I can see it using the Process Explorer utility. How can I release that DLL? My original code used early binding, and I released the COM object after using it by calling System.Runtime.InteropServices.Marshal.ReleaseComObject(). It does not seem to work when I pass it the ClsObj.
-
CoFreeUnusedLibraries[^] might help
Sohail
thanks but I cannot call CoFreeUnusedLibraries() from a .NET C# code.
-
thanks but I cannot call CoFreeUnusedLibraries() from a .NET C# code.