Hi Guys,

I am creating a class to wrap some Excel functionality. My class exposes the IDisposable interface in order to kill Excel once I have finished with it. When I explicitly call my Dispose() method everything is fine. If I leave it up to the framework I get error: "COM object that has been separated from its underlying RCW cannot be used."

When I call Dispose() from my WindowsForms project its is in STA mode; everything is fine. If the framework calls Dispose() the threading state is MTA.

How would I go about ensuring the framework calls Dispose() on the same thread as it was created?

Thanks Guys,
Matt