Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Unit Tests may fail to run with "Not Executed" error with Visual Studio 2008


Symptoms

When attempting to run or debug a unit test from the Test Results toolwindow, the unit tests may fail to execute with the following error:

Code coverage collection error: The Visual Studio performance and coverage logging engine is already running on the computer. Therefore, the test run cannot continue. Close the pending performance or code coverage session and then rerun the tests.

↑ Back to the top


Cause

When the user starts debugging a unit test using one of the toolbar buttons in the Test Results toolwindow, Visual Studio fails to disable the code coverage option when present; and vsperfmon.exe is run while debugging the unit test(s). If the user stops the debug session, vsperfmon.exe continues to run. With vsperfmon.exe still running, any subsequent attempts to run or debug the unit tests will fail with the above mentioned error.

↑ Back to the top


Resolution

There are several ways to avoid or work around this problem.

 1. Remove the Code Coverage setting from the .testrunconfig file(s).
 2. Use the "Debug Checked Tests" command, from the Test List Editor's context menu.
 3. From a Visual Studio Command prompt, run vsperfcmd.exe with the /shutdown command to terminate the vsperfmon.exe process.

↑ Back to the top


More Information

In certain scenarios, it may be more convenient to use an add-in to programmatically invoke vsperfcmd.exe with the /shutdown command, when the DebuggerEvents.OnEnterDesignMode event is fired. The DbgUnitTestFix sample add-in illustrates how this can be done.

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2585317
Revision : 1
Created on : 1/7/2017
Published on : 7/28/2011
Exists online : False
Views : 355