Multi-threading and COM Interop

W

Wayne Hartell

Has anyone ever experienced problems when trying to use COM objects on
worker threads? I'm on to my second application now where multi-threading
has been used to perform some work through COM objects and the application
works great for a while, but if you leave it for a while (let's say 10 to 20
minutes) and come back to it, then mysteriously the cached COM object
references are all dead. Shared objects aren't supposed to die after worker
thread termination, but I've seen it twice now in two separate applications
where it seems that the GC is icing something it shouldn't, which would
explain the indeterminate time period before things start going down hill.

In the last application we couldn't find a solution so we went back to a
single threaded implementation and battled against the issues. I really
don't want to do it again this time. Any silver bullets out there?

Regards,
Wayne.
 
W

Wayne Hartell

Yeah, that sounds like the problem. Building with .Net 2003 and targeting
the framework 1.1 appears to have fixed the problem. 40 mins and counting!

Thanks Mattias.

Wayne.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top