Team Suite 2005 RC - Can't run unit tests when web project is in solution

If I create a solution with only a class library, unit tests run as expected. If I add a web project to the solution in addition to the class library, unit tests will not run and I get an error message like this:

"Operation is invalid for the current state of the object."

Removing the web project from the solution doesn't immediately resolve the problem but by cleaning, rebuilding, and opening the solution from scratch unit tests will work again with only the class library.

Any suggestions?

[506 byte] By [bvsoftware] at [2007-12-17]
# 1
I don't know what the difference is, but I have that configuration working without issues. My solution contains 2 class libraries, a database project, a win forms app, a web service, and a simply set of unit tests for one of the class libraries. My project might be too simple to duplicate your symptoms, but at least know that you symptoms aren't visible in all unit test projects with web projects in the solution.

Good luck with it and keep us all posted!

DaveMcKinstry at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 2
I don't think project complexity is the problem. I can duplicate the issue even with a simple one class library and one page web project solution.
bvsoftware at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 3
I can't repro this here. Can you give us exact repro steps? I tried the following, all completed gracfully...

1: Create Class lib.
2: add test project
3: File/New/Web Site (leave as Filesystem, VB, ASP.Net)

Also

1: File/new/Web Site (leave as Filesystem, VB, ASP.Net)
2: add class library
3: add test project

dhoptonMSFT at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 4

Here are the exact steps I take to duplicate the issue:

1) Start VS 2005

2) File->New->Project->Visual Basic Class Library (check Add solution to source control)
[Source Control is SourceGear Vault 3.01]

3) Add a local variable and public property to class1.vb of type String

4) Right-Click Class->Create Unit Tests->New Visual Basic Test Project

5) Test->Windows->Test Manager->Run All Tests (works as expected)

6) Solution->Add->New Web Site
[Visual Basic, ASP.NET, File System]

7) Test->Windows->Test manager->Run All Tests (error diaglog box)

ERROR DIALOG: Operation is not valid due to the current state of the object.

bvsoftware at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 5
I still can't repro this, but with the help of Sean Lumley we've found a very similar bug, which was fixed just after the RC, so it maybe that you are missing out.

A workaround (albeit not great) is to delete the .suo file in the solution directory.

dhoptonMSFT at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 6
If I delete the .suo file as suggested the unit test error goes away. I hope that helps you identify the issue. Thanks!

bvsoftware at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 7

I had a similar problem, running 2005 RC
I had a solution, with a

  • web site
  • library
  • unit test project

It worked fine for days, then all at once it seemed to throw that exception when I tried to run tests.
I rebuilt the solution, and that didn't fix it.
I closed the solution, removed the .suo file, and that fixed it.
Then I rebuilt, and the compiler found a syntax error it had missed before.
I fixed the error, rebuilt, and tests run fine.

DavidKAllen at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 8

Just made a discovery, Opening the design view in your aspx page, will cause the error. Close your aspx page, not sure how to close the design view. The error will not occur. Maybe there running on the same localhost, don't know. I noticed the error only shows up after i added coded, then realized it was only when i added code in the design view of my default.aspx page.

The unit test runs on some localhost port, there must be something in common with the design view running and the unittest running.

If this fails, then deletion of the sou file or just turning off VS2005 or the project will provide a temporary solution.

DougK at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...
# 9
We have not experienced this problem since moving to the final VS2005 Team Suite. It appears to be corrected in the shipping version of the software.
bvsoftware at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...

Visual Studio Team System

Site Classified