<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx</link><description>Writing deterministic, multi-threaded unit tests may not be your idea of a fun Saturday night, but with a little discipline and knowledge, it can be done, and it sure beats writing multi-dreaded code without the safety net provided by an automated test</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Running Tests as 'MTA'</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#5602743</link><pubDate>Mon, 22 Oct 2007 19:08:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5602743</guid><dc:creator>Dominic Hopton's Blog</dc:creator><description>&lt;p&gt;There was an internal discussion this week about the need to run unit tests under MTA threads, rather&lt;/p&gt;
</description></item><item><title>Running Unit tests as MTA rather than STA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#5602814</link><pubDate>Mon, 22 Oct 2007 19:10:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5602814</guid><dc:creator>VSTS Quality Tools</dc:creator><description>&lt;p&gt;Ever done complex interop testing where you wanted to run as MTA? Needed to call WaitHandle.WaitAll?&lt;/p&gt;
</description></item><item><title>Running Unit tests as MTA rather than STA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#5603684</link><pubDate>Mon, 22 Oct 2007 19:38:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5603684</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;Ever done complex interop testing where you wanted to run as MTA? Needed to call WaitHandle.WaitAll?&lt;/p&gt;
</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#5617307</link><pubDate>Tue, 23 Oct 2007 08:44:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5617307</guid><dc:creator>Kris</dc:creator><description>&lt;p&gt;What is the reason why the MSTest runs in STA by default? I can understand if it is a WinForms app, but for testing a library of code why does the test default to STA?&lt;/p&gt;</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#5620187</link><pubDate>Tue, 23 Oct 2007 10:53:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5620187</guid><dc:creator>ploeh</dc:creator><description>&lt;p&gt;Performance, they told me.&lt;/p&gt;
</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#6131616</link><pubDate>Mon, 12 Nov 2007 11:38:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6131616</guid><dc:creator>Anup</dc:creator><description>&lt;p&gt;This post was very helpful to me.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#7023247</link><pubDate>Tue, 08 Jan 2008 06:24:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7023247</guid><dc:creator>Ben Szymkow</dc:creator><description>&lt;p&gt;This article was helpful to me. Thank you!&lt;/p&gt;</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#8646968</link><pubDate>Tue, 24 Jun 2008 14:47:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8646968</guid><dc:creator>Juanma</dc:creator><description>&lt;p&gt;Hi, i found your post via MSDN Forums.&lt;/p&gt;
&lt;p&gt;I set the configuration file like this:&lt;/p&gt;
&lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;TestRunConfiguration id=&amp;quot;97f0ad10-8fae-403e-b242-ed18618a9b7c&amp;quot; name=&amp;quot;TestConWCF&amp;quot; xmlns=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://microsoft.com/schemas/VisualStudio/TeamTest/2006&amp;quot;&amp;gt;"&gt;http://microsoft.com/schemas/VisualStudio/TeamTest/2006&amp;quot;&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;	&amp;lt;Description&amp;gt;This is a default test run configuration for a local test run.&amp;lt;/Description&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;ExecutionThread apartmentState=&amp;quot;1&amp;quot;/&amp;gt; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;/TestRunConfiguration&amp;gt;&lt;/p&gt;
&lt;p&gt;But I still getting the same error:&lt;/p&gt;
&lt;p&gt;FatalExecutionEngineError was detected&lt;/p&gt;
&lt;p&gt;Message: The runtime has encountered a fatal error. The address of the error was at 0x79eb59e7, on thread 0x79c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.&lt;/p&gt;
&lt;p&gt;I'm working with VS 2008 and I don't know what I'm doing wrong.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#8653860</link><pubDate>Thu, 26 Jun 2008 02:09:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8653860</guid><dc:creator>ploeh</dc:creator><description>&lt;p&gt;Hi Juanma&lt;/p&gt;
&lt;p&gt;Thank you for your question.&lt;/p&gt;
&lt;p&gt;While I don't know why you get that specific error, to verify my previous description I just loaded up my sample project in Visual Studio 2008 to see if I would have the same problem, which I don't.&lt;/p&gt;
&lt;p&gt;My guess is that your problem isn't specifically related to the execution thread's apartment state, but I can't be sure.&lt;/p&gt;
&lt;p&gt;If you'd like, I can send you my sample project so you can run it to give you an indication whether you are having a problem with your specific project or perhaps your VS installation or something else.&lt;/p&gt;
&lt;p&gt;In this case, drop me a line via the blog's Contact form so I get your e-mail address, and I'll send you the sample code.&lt;/p&gt;
</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#8716181</link><pubDate>Thu, 10 Jul 2008 12:28:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8716181</guid><dc:creator>deepak</dc:creator><description>&lt;p&gt;after adding the line &amp;lt;ExecutionThread apartmentState=&amp;quot;1&amp;quot; /&amp;gt; in testrunconfig file&lt;/p&gt;
&lt;p&gt;I am getting the following error :&lt;/p&gt;
&lt;p&gt;Invalid cast from 'System.String' to 'System.Threading.ApartmentState'.&lt;/p&gt;
&lt;p&gt;I am using vs2008. let me know, if i am missing anything...&lt;/p&gt;</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#8716219</link><pubDate>Thu, 10 Jul 2008 12:38:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8716219</guid><dc:creator>ploeh</dc:creator><description>&lt;p&gt;Hi deepak&lt;/p&gt;
&lt;p&gt;As I responded to Juanma, I can send you my sample project so you can take a look at that. If you are interested, drop me a line via the blog's Contact form.&lt;/p&gt;
</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#8960242</link><pubDate>Sun, 21 Sep 2008 01:21:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8960242</guid><dc:creator>Stanislav Dvoychenko</dc:creator><description>&lt;p&gt;Hi Mark,&lt;/p&gt;
&lt;p&gt;Thanks for sharing. As I required granular ability to use MTA or STA within a test run I put together a simple helper class to achieve this: &lt;a rel="nofollow" target="_new" href="http://plainoldstan.blogspot.com/2008/09/run-unit-test-on-mta-thread-vsts-test.html"&gt;http://plainoldstan.blogspot.com/2008/09/run-unit-test-on-mta-thread-vsts-test.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please let me know if there are drawbacks if you would have a spare minute.&lt;/p&gt;</description></item><item><title>re: Running MSTest In An MTA</title><link>http://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx#8961462</link><pubDate>Mon, 22 Sep 2008 21:47:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8961462</guid><dc:creator>ploeh</dc:creator><description>&lt;p&gt;Hi Stanislav&lt;/p&gt;
&lt;p&gt;Thank you for sharing. I posted a more elaborate comment directly at your post :)&lt;/p&gt;
</description></item></channel></rss>