Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How can I force NCrunch to run tests in STA?
borysl
#1 Posted : Friday, December 7, 2012 12:52:40 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/7/2012(UTC)
Posts: 1
Location: Ukraine

I get this error System.InvalidOperationException : The calling thread must be STA, because many UI components require this.
on show component

I know what this problem is and thus in my NUnit tests I use this configuration:
<configSections>
<sectionGroup name="NUnit">
<section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>

<NUnit>
<TestRunner>
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>

However looks like NCrunch ignores NUnit configuration and runs anyway in MTA.

yanglee
#2 Posted : Friday, December 7, 2012 1:45:55 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/25/2012(UTC)
Posts: 89
Location: China

Thanks: 23 times
Was thanked: 19 time(s) in 18 post(s)
I got this error before when I use Resharper. The solution was add [STAThread] to the test method.
1 user thanked yanglee for this useful post.
Remco on 12/7/2012(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.020 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download