COM Multithreading garbage collector

Oct 30 2008 5:13 AM

Hello,

I create  multiple STA threads,  each one creates its own instance of the COM object.

For unknown reasons, sometimes when I run the C# application, one of the thread crash with an "Access violation" exception on one of the COM method call.

Looking close at the C# call stack, it seems that during the reflection phase to get the method, the COM object reference is null. As if the COM object does not exist or more precisely  the RCW for this thread does not reference any COM object.

Is it possible that the COM object is garbage collected when the first thread terminates and consequently RCW instances in other running threads have a reference to a non existing COM object?

Do you have any idea?

Thanks.
brimble