|
-
Aug 22nd, 2007, 10:01 PM
#1
Thread Starter
Lively Member
[2005] Assembly Threading Apartments
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
-
Aug 22nd, 2007, 10:28 PM
#2
Thread Starter
Lively Member
Re: [2005] Assembly Threading Apartments
Also, I plan to compile this into a class library. So I cant control what threading state the calling assembly with be in.
Maybe I have to create my own thread within the class and perform all operations there??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|