Questions tagged [apartment-state]
20 questions
0
votes
1 answer
How can I set the runspace of PowerShell code I am running from c#?
I have an app which runs several Powershell scripts. (It is basically a wrapper application that pulls some PS scripts stored in a SQL database and then runs them.)
One of the Powershell scripts I have added is failing now, and I have a feeling it…

Ben
- 4,281
- 8
- 62
- 103
0
votes
1 answer
ArgumentOutOfRangeException in SetApartmentState
I have such piece of code:
var t = new Thread(ShowStatus);
t.SetApartmentState(ApartmentState.STA);
And once I've got exception ArgumentOutOfRangeException on second line. How is it possible? And what can I do to prevent it from happenning again…

jfgi
- 107
- 1
- 10
0
votes
1 answer
SpecFlow NUnit RequiresSTA attribute
I need to have SpecFlow generate NUnit Tests with the RequiresSTA attribute. How can I do that?

MatteS
- 1,542
- 1
- 16
- 35
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
1 answer
Applying LoaderOptimization to in-process COM servers
I need to create multiple AppDomains in my .NET in-process COM server (it's a Windows Explorer namespace extension).
In my test Console Application, i am able to create 10 domains + WPF windows in 40 seconds, which is unacceptable.
Adding…

wizzard0
- 1,883
- 1
- 15
- 38