Hi Valentijn,

The thing is that I already have a config file to take care of the same problem 
when I run my test suite using Nunit-GUI. But it seems that when I run the same 
suite of tests using NAnt, that config file is not read. Is it that I need to 
place the config file in some particular directory for NAnt to pick it up? Can 
I just add the settings to "NAnt.exe.config" and expect it to work?

I also tried setting the state of the current thread within my test case 
itself. It prevented the exception from being thrown but it did not execute my 
source code either.... :(
The line of code is as follows :

System.Threading.Thread.CurrentThread.SetApartmentState(System.Threading.ApartmentState.STA);

Waiting for your reply.............

Prateek Agarwal
Keane (India)

From: Valentijn Makkenze [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 29, 2008 9:45 PM
To: Agarwal, Prateek; nant-users@lists.sourceforge.net
Subject: RE: STAThread Exception while running Nant

Hi,

Add this to your app.config

  <NUnit>
    <TestCaseBuilder>
      <add key="OldStyleTestCases" value="false" />
    </TestCaseBuilder>
    <TestRunner>
      <!-- Valid values are STA,MTA. Others ignored. -->
      <add key="ApartmentState" value="STA" />
      <!-- See ThreadPriority enum for other valid values -->
      <add key="ThreadPriority" value="Normal" />
    </TestRunner>
  </NUnit>

Success,

Valentijn

________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Agarwal, Prateek
Sent: dinsdag 29 januari 2008 12:16
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] STAThread Exception while running Nant

Hi,

I am using Nant to run a suite of test cases. Certain test cases are throwing a 
threading exception suggesting that the ApartmentState should be changed to 
STA. I am not able to do so since I do not have a main method to add the 
STAThread attribute to. What else can be done?

Thanks in advance.

Prateek Agarwal
Keane (India)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to