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:
A code coverage file that covers the project under test with no errors.
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.
dotnet --version
output:
This scenario works if I manually drop the CodeCoverage.Shim dll that the nuget package contains under %ProgramFiles%/dotnet/bin.
Even with this workaround code coverage seems to be working only for netstandard
assemblies, but not for net4褏褏
ones. In other words, in the VS's Code Coverage Results only netstandard
assemblies are listed, though I know that net4xx
assemblies were called by the tests.
@dotnet/vstest I'm going to close this issue on CLI, but getting Code Coverage as a feature in the near future will be great :D
Why is this issue closed if the problem is not solved?
Same for VS 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.......
I have the same issue as of today. .NET Core 2.0 project XUNIT test project.
same for me on my xUnit project on the .NET Standard style *.csproj files. .NET Framework old style *.csproj files like the ones here: https://github.com/Elskom/zlib.managed/ are not affected.
I am tempted to add a command to dotnet test
that generates a coverage xml file like I use OpenCover for so that way I can drop OpenCover and use dotnet test
for the coverage file to codecov.io
.
Most helpful comment
Why is this issue closed if the problem is not solved?