I have a COM component developed in Visual C++ 6 (Say COM_SDK6), and a VB.net client is calling this component.
VB.net client program is specifically calling gc.collect method from its code. Due to this, the order in which destructors of COM_SDK6 is getting called gets random. That is, destructors(of different objects exposed by COM_SDK6) get called in any sequence.
Is it a known feature/limitation of .Net? Or I am making some blunder in the code?
From what I understand you should never call GC from your code, Its expensive and it probably won’t give you the results your looking for. Take a look at Marshal.ReleaseComObject & Marshal.FinalReleaseComObject
Thanks a lot for your suggestion. You are right we can control object deletion by calling FinalReleaseComObject.
One more suggestion, in case you can help:
For using COM_SDK6 component, I am doing "Add Reference" for tlb of Say COM_SDK6 in VB.Net. I have neither done any TLBImp nor written any RCW. Is this right?