Home Dashboard Directory Help
Search

Launching unit tests in debugger fails every other time when a project started life as WCF application(Related to: 536475) by Emil Macarie


Status: 

Closed
 as Duplicate Help for as Duplicate


14
0
Sign in
to vote
Type: Bug
ID: 650038
Opened: 3/7/2011 4:34:45 PM
Access Restriction: Public
1
Workaround(s)
view
11
User(s) can reproduce this bug

Description

In Visual Studio there is a problem with how WCF Service Application projects are built and the effect is that 50% of unit test runs fail.
Take the following scenario:

1) Start new VS 2010 solution
1) Created 3.5 WCF Service Library
2) Created second executable project
3) Created third unit test project
4) In the Wcf options for the WCF service library, disable Start WCF Service Host

Run unit tests and half of the tests will fail as they are not able to start QTAgent32.exe

It looks like the problem is that VS insists on building the WCF Service Library project EVERY time.
The only workaround is to remove the WCF extensions from the csproj file.

This is a specific instance of bug 536475.
Details
Sign in to post a comment.
Posted by Aseem Bansal [MSFT] on 8/7/2012 at 2:54 AM
Hi Emil,

Thanks for your feedback.

We have fixed this problem in the coming VS 2012 release (http://www.microsoft.com/visualstudio/11/en-us). Please try this out and do let us know in case it does not work for you.

Regards
Aseem Bansal
Posted by Igby Dalziel on 11/10/2011 at 8:23 AM
If you have a WCF service project in your solution, that is almost certainly the cause. Please see https://connect.microsoft.com/VisualStudio/feedback/details/536475/launching-unit-tests-in-debugger-fails-every-other-time-cannot-start-qtagent32-exe as there are some workarounds posted there.
Posted by janosch_daiw on 7/19/2011 at 2:18 AM
I'm getting the same error using VS2010 (no SP installed yet) on a Windows Server 2008 R2 SP1 machine. It occurs when testing a private setter of a property.

The property looks like this:

public string Title
{
get { return Title; }

private set
{
    if(String.IsNullOrEmpty(value))
    {
     throw new ArgumentNullException("No Title given");
    }
    if(value.Length > 50)
    {
     throw new ArgumentOutOfRangeException("Title", value, "Title is too long.");
    }

Title = value;
}
}


Testcases that expect an exception will succeed, e.g.:

[TestMethod, ExpectedException(typeof(ArgumentNullException))]
public void CategoryTitleEmptyTest()
{
Category_Accessor ctAcc = new Category_Accessor();
traAcc.Title = "";
}

or

[TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void CategoryTitleTooLongTest()
{
Category_Accessor ctAcc = new Category_Accessor();
ctAcc.Title = "Title is way toooooooooooooooooooooooooooooooooooooooooooooooooooo long";
}

But on tests for a "positive" result using Assert.Equal() QtAgent32 crashes, e.g.

[TestMethod]
public void CategoryTitleOkTest()
{
Category_Accessor ctAcc = new Category_Accessor();
ctAcc.Titel = "Cat 42";
Assert.AreEqual("Cat 42", ctAcc.Titel);
}

QtAgent32 crashes on every test run on these testcases. But if I change the property like this ...

public string Title
{
get; private set;
}

... the "broken" tests "CategoryTitleOkTest()" will run smoothly. Unfortunately my checks are lost ;)
Posted by Jing7 on 6/28/2011 at 1:09 AM
My steps to reproduce:
1. restart VS 2010 and open solution
2. run tests multiple times, everything works fine
3. press F5 and run whole project in Debug session. Close it.
4. run tests multiple times, 50% chance of the "QTAgent32.exe" failure.

And so the workaround is:
- restart VS 2010 after using F5 (Debug) mode
Posted by bojingo on 6/2/2011 at 8:06 AM
I am getting this also. VS 2010 SP1 (I just upgraded to SP1 yesterday hoping it would finally fix this dreaded bug - nope) Win 7 64.

In the "Test Results" window there is a link called "Test run error" on the yellow label that gives you the results summary. Clicking this link yields the following:

Error    6/2/2011 10:41:03 AM    Failed to queue test run '[UserName]@[MachineName] 2011-06-02 10:41:01': Unable to start program 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\QTAgent32.exe'.

All tests show the result "Not Executed". If I run the test again while it is in this state they all run successfully but I will have an extra instance of "QTAgent32.exe *32" running in task manager. Each couple times I run the test I get yet another instance running. In a full day of work I might have 30-40 instances that I have to manually kill occasionally or they sometimes seem to impact my test results (even when not debugging).
Posted by strdusty on 4/6/2011 at 8:02 AM
I experience the same problem and am on VS2010 SP1 Win 7 64.
Posted by Microsoft on 3/7/2011 at 5:13 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Jing7 on 6/28/2011 at 1:10 AM
restart VS 2010 after using F5 (Debug) mode
File Name Submitted By Submitted On File Size  
WcfTestErrors.zip 3/7/2011 63 KB