Results 1 to 2 of 2

Thread: [2005] Assembly Threading Apartments

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    65

    [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

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    65

    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
  •  



Click Here to Expand Forum to Full Width