Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3495334
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:06:51+00:00 2026-05-18T12:06:51+00:00

I am using a STA COM object from a back ground thread, one of

  • 0

I am using a STA COM object from a back ground thread, one of the COM object’s a method will block, when i call it from a new thread which is in STA threading mode since the COM object’s mode is STA, and the UI thread seems gets blocked too, can i avoid this UI blocking?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:06:51+00:00Added an answer on May 18, 2026 at 12:06 pm

    That’s the point of STA, COM will automatically marshal the call from your worker thread to the STA thread. So that the COM server methods are always called in a thread-safe way. And if the method blocks, that will also block your STA thread. Usually the UI thread.

    This means for one that using this COM object in a thread doesn’t actually accomplish anything. For another that the real problem is in the COM server, it shouldn’t be blocking. Do make sure this isn’t a deadlock situation.

    A possible workaround is to create the COM server on another STA thread so at least your UI thread doesn’t get blocked. Check this answer for sample code. Both the Thread.SetApartmentState and the Application.Run calls are crucial to create a hospitable home for the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Thread is pretty straightforward Thread thread = new Thread(MethodWhichRequiresSTA); thread.SetApartmentState(ApartmentState.STA); How to accomplish
Using TeamCity, I'm trying to get a (TestAutomationFX) test that requires an STA thread
Problem: Event notifications (From COM object - Server) are not received as listed in
I am getting following error: COM object that has been separated from its underlying
I am new to COM and trying to understand the difference between STA and
I am using a 3rd-party rotator object, which is providing a smooth, random rotation
Is there any way to execute a method of a com object inside a
Is it a bad thing to spawn worker threads in your STA COM object
I'm using com interop to talk to some physical piece of hardware. When I
I am attempting to pull some information from my tnsnames file using regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.