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

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


 
This morning i was run into the issue where trying to run unit test , where the method contains Mutithread call within it , it throws an error "System.NotSupportedException: WaitAll for multiple handles on a STA thread is not supported". After a while googling around the web i got the solution as follows
 
If I edit the localtestrun.testrunconfig xml file and change the apartmentState setting to 1 (default is 0) the unit test runs my code correctly.
<    <apartmentState type="System.Threading.ApartmentState">
          <value__ type="System.Int32">1</value__>
  </apartmentState>
 
Advertisements
Categories: UNITTEST
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: