NCover Documentation

If NCover is run but for some reason it does not connect to any processes, the following error is presented:

No data was collected.
For more information, see http://www.ncover.com/lt/no-data

NCover.Console is returning exit code #20000

Prior to NCover 3.4.9 that error was actually displayed as an exception:

***************** Exception *****************
----

NCover.Console is returning exit code #20000

-------------------------------------------------------------------------
---- Top level exception: System.Exception
No data was collected.
  at NCover.Framework.ProfilerDriver._GetCoverageData()
  at NCover.Framework.ProfilerDriver.ExecuteNCover(Int32& profiledAppCode)
  at NCover.Framework.ProfilerDriver.Execute(Int32& profiledAppCode)
  at NCover.ConsoleMain.ConsoleMain.RunCoverage(String[] args, IOutputWriter output)
-------------------------------------------------------------------------------

The reason no data was collected is usually one of the following:

1. The application NCover was run on was a native application, so it could not be covered. NCover only runs on .NET applications running in the CLR.

2. The 64-bit version of NCover was used on a 32-bit application or the 32-bit version of NCover was used on a 64-bit application.

3. The wrong process name was specified, or NCover made a bad guess as to what the process name should be.

4. You were trying to cover one of the automatically excluded assemblies that NCover ignores, including NUnit assemblies, MSTest assemblies, MS core assemblies, etc. If you are trying to cover any of these, you can reconfigure NCover's NCover.Console.exe.config file found in the NCover installation directory. Simply comment out ( ) any of the XML regular expressions that apply to the assemblies you're trying to cover.

Follow these steps to resolve a "No data was collected" error:

1. Update NCover to the latest version. That will ensure that you're not experiencing a bug that has been fixed in a more recent version. You can download the latest version of NCover at http://www.ncover.com/download.

2. Make sure that your application is a .NET application rather than a native application. You can use the command-line application corflags.exe to check this. If your application is a managed application it will have output like:


> corflags.exe "C:\Program Files\NCover\NCover.Console.exe"

Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Version   : v2.0.50727
CLR Header: 2.5
PE        : PE32
CorFlags  : 11
ILONLY    : 1
32BIT     : 1
Signed    : 1

Native applications, on the other hand, will display an error:


> corflags C:\Windows\notepad.exe

Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

corflags : error CF008 : The specified file does not have a valid managed header

If your application is native, NCover can't collect coverage data on it.

3. Make sure that you're running the right version of NCover for your application. This only applies to users running on 64-bit systems. To determine what version of NCover to run, look at the output from corflags.exe. Here's a table of the flags and what type of assembly you're looking at based on those flags:

Type PE 32BIT
32-bit PE32 1
64-bit PE32+ 0
AnyCPU PE32 0

So, given the corflags example above:


> corflags.exe "C:\Program Files\NCover\NCover.Console.exe"

Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Version   : v2.0.50727
CLR Header: 2.5
PE        : PE32
CorFlags  : 11
ILONLY    : 1
32BIT     : 1
Signed    : 1

We're running a 32-bit application because the PE flag is PE32 and the 32BIT flag is 1.

If your application is 64-bit, you'll need to run the version of NCover from C:\Program Files\NCover\. If your application is 32-bit, you'll want to run the 32-bit version of NCover from C:\Program Files (x86)\NCover\. If your application is AnyCPU you probably want to run the version from C:\Program Files\NCover.

4. Make sure that NCover is monitoring your process. The easiest way to do this is to look at the NCover output and ensure that a message is displayed like the one underlined below for the process you're trying to monitor:


Command: "Gallio.Echo.exe"
Command Args: "SampleGallio.dll"
Working Directory:
Assemblies: (All Loaded Assemblies)

******************* Program Output *******************
Process 'Gallio.Echo' [PID 6944] has begun profiling.

Gallio Echo - Version 3.1 build 397
Get the latest version at http://www.gallio.org/

Start time: 2:52 PM
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.

If no messages are included in NCover's output stating that a process has begun profiling you'll need to add either //coverall (Cover all subprocesses) or //pn (Process name) arguments to NCover to ensure that NCover collects coverage for your target process.

If NCover detects that you're running a popular .NET testing tool, it may try to automatically guess the process name arguments. Sometimes, though, those names are incorrect for the specific version of your testing framework being used. In that case, you can disable NCover automatically setting the process name flag with the //literal parameter, or by checking the "Turn literal mode on" checkbox in your project settings for NCover Explorer.

If you follow the above steps and NCover continues to return a "No data was collected" error, contact our support team.

If you still need technical assistance, we can help:

Submit A Support Ticket

Try NCover Free Contact Us Online