STA exception when running a unit test w/i VS via Resharper 3.0

I have a simple unit test that tests a thread synchronization issue. When I run it via Resharper from within VS it gives an exception. The main gist of the unit test is as follows:

List autos = new List]]>();
for (int i = 0; i < 5; i++)
autos.Add(new AutoResetEvent(false));
int x = i;



When I run this I get an exception on the WaitHandle.WaitAll call that looks like this:

System.NotSupportedException: WaitAll for multiple handles on a STA thread is not supported.

If I run this same unit test from within NUnit console... I get no problems.

Is there any way to get this to work?
I've tried setting the ApartmentState in the Config file to MTA, however Resharper shows NO success or failure indicators in the UI.

Anyone have any thoughts on how to address this?

Please sign in to leave a comment.