Questions tagged [sta]

Single-Threaded Apartment of the Component Object Model (COM), as opposed to MTA

STA refers to the Single-Threaded Apartment of Microsoft's Component Object Model (COM). Its opposite is the Multiple Threaded Apartment (MTA), but there is also a Neutral Apartment.

Related tags:

References:

230 questions
0
votes
2 answers

ASP.NET WCF Service error "The calling thread must be STA, because many UI components require this. "?

I have some window workflows which use some .net assemblies. I am accessing some hardware from these workflow windows. My XYZ services which are being published on IIS through virtual directory method help this all. Now I want to consume these…
0
votes
1 answer

Error coming up when trying to open up file browser

Currently on my website i am trying to get it so that a user can upload an image from their local images. I have followed a tutorial, but when i debug it and try to open up my images folder i get this error message: "Current thread must be set to…
CallumHolden
  • 83
  • 1
  • 12
0
votes
1 answer

Can a BackgroundWorker join (link to, access, invoke, become) the STAThread

I'm not super familiar with what exactly the STAThread does (is), so I'm not sure if my question is even properly stated. I have a process running in a BackgroundWorker thread that copies the contents of an Excel range to the clipboard…
sergeidave
  • 662
  • 4
  • 11
  • 23
0
votes
1 answer

how do I delay instantiation of the main form until responded to an event in a WinForms app?

Some background: I get the following exception in my code below. ThreadStateException : ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. The Main()…
John Maillet
0
votes
1 answer

Reporting Progress from COM/STA Thread to WPF UI thread

I working on an application that prints PDFs using COM and the Acrobat SDK. The app is written in C#, WPF and I am trying to figure out how to run the printing correctly on a separate thread. I have seen that a BackgroundWorker uses the thread…
jle
  • 9,316
  • 5
  • 48
  • 67
0
votes
1 answer

STA thread in wpf

I have a problem with ListViewItem.When i use it in a thread, it display a message: "The calling thread must be STA, because many UI components require this." and then I change it to : Mythread.SetApartmentState(ApartmentState.STA); Although when…
teardrop
  • 545
  • 3
  • 9
  • 18
0
votes
1 answer

AccessViolationException and Faulting module: What is causing this exception? Is it the faulting module?

If an AccessViolationException occurs, does the faulting module related to it mean that it's a bug in that module, which in our case happens to be one of our third-party DLLs? Or is this much more complicated problem? We have contacted the makers of…
user405723
  • 481
  • 3
  • 7
  • 21
0
votes
1 answer

Hooking thread exit

Is there a way for me to hook the exit of managed threads (i.e. run some code on a thread, just before it exits?) I've developed a mechanism for hooking thread exit that works for some threads. Step 1: develop a 'hook' STA COM class that takes a…
mackenir
  • 10,801
  • 16
  • 68
  • 100
0
votes
2 answers

Creating New usercontrol with BackgroundWorker Fail

I've looked around google cause i need to mutithread as my program lags whenever it attempts to load a gif and load a usercontrol at the same time. Rather, the gif hangs and the the page suddenly shows my usercontrol without any transition. Ok How…
user1423316
0
votes
1 answer

WebBrowser navigating inside a STAThread within a BackgroundWorker understanding

I was struggling finding a good title as I already solved my problem. I just need an explication of how I solved it ... because I am diving into stuff I just discovered today and it may not be clear right now for me. So in order to resume my problem…
Al_th
  • 1,174
  • 1
  • 12
  • 24
0
votes
2 answers

The calling thread must be STA, because many UI components require this WPF

I am using the MessageBox provided by WPF Toolkit. And I get the error The calling thread must be STA, because many UI components require this new Thread(new ThreadStart(delegate { MessageBox.Show("Opeartion could not be completed. Please try…
xaria
  • 842
  • 5
  • 24
  • 47
0
votes
2 answers

Memory leakage in WebBrowser control Automation C# console application test

The following (in P.S. of this posting) test code results in memory leakage. Could you please advise how to solve this memory leakage issue? FYI: I'm using VS2010 Prof, .NET Framework 4.0, Win7 Ultimate and IE9. The test code can be activated by…
ShamilS
  • 1,410
  • 2
  • 20
  • 40
-1
votes
1 answer

WPF .Net update Progress Bar while loading Classes

I am creating a WPF MVVM Application where I have a Main Window and different Pages displayed in a Frame. I want to add a Loading Screen with a Progress Bar which updates while the Instances for the Pages get created: Dim customer_page as new…
-1
votes
1 answer

COM thread apartments (STA, MTA) management in C# app process

I'm trying to understand C# thread apartments and have questions: What exactly apartment is and what it contains? The Apartment and the COM Threading Architecture A process can have zero or more single-threaded apartments and zero or one…
Woldemar89
  • 682
  • 4
  • 10
-1
votes
1 answer

STAThread error in System.Timers.Timer, while instantiating Form with AutoCompleteMode of dropdown set

I have, Windows Form, which have System.Timers.Timer in elapsed event of this timer, I wish to popup a form using ShowDialog(), over there while creating object of that form itself, I am getting following error. Current thread must be set to single…
Aniket Bhansali
  • 630
  • 12
  • 33
1 2 3
15
16