Running unit tests (with code coverage) in VS 2010 SP1 with IIS Express hosted project - by Peter LaComb

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


11
0
Sign in
to vote
ID 650894 Comments
Status Closed Workarounds
Type Bug Repros 3
Opened 3/11/2011 10:14:59 AM
Access Restriction Public

Description

When attempting to run unit tests with code coverage in VS 2010 SP1 on an IIS Express hosted project, VS will not run any tests. Two messages are consistently added to the test run errors:

Cannot open the asp.net project '<project name>'

and

Failed to queue tests for test run 'test run name': Exception has been thrown by the target of an invocation.

This problem does not appear when debugging those tests, but that disables code coverage.
Sign in to post a comment.
Posted by MurrayD on 10/3/2011 at 1:49 PM
Happening for me with the exception below. MVC3 project, Windows XP SP3. (FYI Running as Administrator but the IIS Express metabase is on a mapped network drive).

The following information is part of the event: (devenv.exe, PID 1688, Thread 24) ControllerProxy.UpdateForAspNetCoverageProject threw in creating AspNetHelper for 'XXX.Infrastructure.DistributedServices': Microsoft.VisualStudio.Enterprise.Common.AspNetHelperException: The website metabase contains unexpected information or you do not have permission to access the metabase. You must be a member of the Administrators group on the local computer to access the IIS metabase. Therefore, you cannot create or open a local IIS Web site. If you have Read, Write, and Modify Permissions for the folder where the files are located, you can create a file system web site that points to the folder in order to proceed. ---> System.Runtime.InteropServices.COMException: Unknown error (0x80005000)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.ChildEnumerator..ctor(DirectoryEntry container)
at Microsoft.VisualStudio.Enterprise.Common.IISHelper.GetWebServerOrdinal(Uri site)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Enterprise.Common.IISHelper.GetWebServerOrdinal(Uri site)
at Microsoft.VisualStudio.Enterprise.Common.IISHelper.get_WebServerOrdinal()
at Microsoft.VisualStudio.Enterprise.Common.IISHelper.get_RootPath()
at Microsoft.VisualStudio.Enterprise.Common.IISHelper.get_PhysicalPath()
at Microsoft.VisualStudio.Enterprise.Common.AspNetHelperMan..ctor(Uri uri, BasicAuthCredential credential, Int32 frameworkMajorVersion)
at Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager.UpdateForAspNetCoverageProject(TestRunConfiguration runConfig, AspNetProjectItem project, DeploymentHelper helper)..
Posted by TMalcolm on 8/23/2011 at 7:15 AM
Check out your Windows Event viewer. My Visual Studio is logging exceptions, although I'm not sure what it is trying to tell me that I've done wrong.
Posted by Peter LaComb on 3/18/2011 at 11:17 AM
Additionally, I'm running Win 7 Pro SP1, x64.
Posted by Peter LaComb on 3/18/2011 at 11:16 AM
The attached is a default MVC2 Site with tests, and two test settings files with code coverage enabled. The MVC Site is currently set to use IIS, and the IIS Code Coverage settings, and tests run as expected. Set the MVC site to use IIS Express, and switch to that test settings file, and tests fail as described.
Posted by Microsoft on 3/14/2011 at 10:25 PM

Thank you for reporting this issue. Unfortunately, we are unable to reproduce the issue with the steps you provided.

Could you please provide us with the following information?

1. A video to show the whole process.
2. A sample project zip.

It would be greatly appreciated if you could provide us this information as quickly as possible.

Thank you
Posted by Microsoft on 3/11/2011 at 11:18 AM
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)