question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code Coverage does not work even after adding the code coverage nuget.

See original GitHub issue

Steps to reproduce

The attached project has a simple xunit test. There are two ways to repro this:

The more easier way of reproing this is : From a developer command prompt run vstest.console.exe project.json /useVsixExtensions:true /enableCodeCoverage

For the VS IDE repro you can use this:

  1. Open it in VS.
  2. Open Test Explorer.(Test -> Windows -> Test Explorer)
  3. Build the solution to trigger discovery.
  4. Right Click on the discovered test and “Analyze code coverage”

Repro.zip

Expected behavior

A code coverage file that covers the project under test with no errors.

Actual behavior

The following error occurs: Error: Unable to start C:\Program Files\dotnet\bin\dotnet.exe

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.VisualStudio.CodeCoverage.Shim, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. at Microsoft.DotNet.Cli.Program.Main(String[] args)

This scenario works if I manually drop the CodeCoverage.Shim dll that the nuget package contains under %ProgramFiles%/dotnet/bin.

Environment data

dotnet --version output:

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
dandagocommented, Mar 9, 2017

Why is this issue closed if the problem is not solved?

7reactions
treenewlyncommented, Oct 30, 2017

System.IO.FileNotFoundException : Could not load file or assembly ‘Microsoft.VisualStudio.CodeCoverage.Shim, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

no work…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Coverage does not work even after adding the ...
This scenario works if I manually drop the CodeCoverage.Shim dll that the nuget package contains under %ProgramFiles%/dotnet/bin. Even with this ...
Read more >
Publish Code Coverage doesn't work in .NET Core Azure ...
I am trying to add Code Coverage results in an Azure DevOps build for a .NET Core project, but, trying two different approaches...
Read more >
Troubleshoot code coverage - Visual Studio
Code coverage analysis is done while tests are running. It only includes assemblies that are loaded into memory when the tests run. If...
Read more >
code coverage not working - Developer Community
I have created a simple solution with a class library project and a unit test project. The test runs but then no coverage...
Read more >
Code Coverage is Finally Easy in .Net Core
A couple of months ago calculating code coverage on the command line was quite challenging in ASP.Net Core. Fortunately, as of last month...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found