Test Runner Thread Apartment State Setting

i have recently come into some trouble with running tests against an activeX component whereby the thread apartment state is required to be STA to be run under NUnit, however, i am unable to work out how to configure the test runner under R# to achieve the same thing.

the test runner throws an exception like:
System.Threading.ThreadStateException:
ActiveX control '6ba21c22-53a5-463f-bbe8-5cf7ffa0132b' cannot be instantiated because the current thread is not in a single-threaded apartment.

I had been using R# 3.1 until yesterday when i upgraded to 4.0 which seems to have changed the thread state model to MTA.

can anyone point me in the right direction on configuring R# to run it STA?

Cheers,
Drew
MyProGo.com

1 comment

It's been a while since I've had to do this, but you need to add an
App.config file to your test project with the following contents. If I
remember correctly, I think this works for both NUnit and ReSharper... or at
least it did when I had to flip the apartment state to MTA to test some
threading code.

"drew.macleod" ]]> wrote in message
news:5783794.82681219994237217.JavaMail.jive@app4.labs.intellij.net...

i have recently come into some trouble with running tests against an
activeX component whereby the thread apartment state is required to be STA
to be run under NUnit, however, i am unable to work out how to configure
the test runner under R# to achieve the same thing.

>

the test runner throws an exception like:
System.Threading.ThreadStateException:
ActiveX control '6ba21c22-53a5-463f-bbe8-5cf7ffa0132b' cannot be
instantiated because the current thread is not in a single-threaded
apartment.

>

I had been using R# 3.1 until yesterday when i upgraded to 4.0 which seems
to have changed the thread state model to MTA.

>

can anyone point me in the right direction on configuring R# to run it
STA?

>

Cheers,
Drew
MyProGo.com


0

Please sign in to leave a comment.