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.

Running coverlet global tool over dotnet build intermittently fails to open file when calculating coverage

See original GitHub issue

In my project https://github.com/SharpGenTools/SharpGenTools I’ve recently switched to using Coverlet for my code-coverage instrumentation. I’ve been encountering an intermittent issue where the Coverlet global tool is unable to open the hits file since it is being used by another process.

This only happens when I’m using the Coverlet global tool to instrument my MSBuild tasks while running dotnet build.

Here’s the repro steps that I have:

  1. Clone SharpGenTools
  2. In Powershell run ./build ; ./test. That will build SharpGenTools and then run the tests. It will likely fail to build the outerloop tests because the process will be unable to access the hits file.

Alternatively, run the following commands from the cloned build:

./build
./build/deploy-test-packages Debug
./build/build-outerloop-native
dotnet restore ./SdkTests/SdkTests.sln
coverlet ".\SdkTests\RestoredPackages\sharpgentools.sdk\2.0.0-local\tools\netstandard1.3\SharpGenTools.Sdk.dll" -t "dotnet" -a "build ./SdkTests/SdkTests.sln /nodeReuse:false --no-restore" -f opencover -o ./artifacts/coverage/outerloop.xml --include-test-assembly --include-directory .\SdkTests\RestoredPackages\sharpgentools.sdk\2.0.0-local\tools\netstandard1.3

The last command will fail with the issue.

I can also privately send you a minidump reproing the issue if you want.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
StevenTCramercommented, Jul 28, 2019

The process cannot access the file ‘C:\agent_work\6\s\test\TestApp.EndToEnd.Tests\bin\Debug\netcoreapp3.0\BlazorState.dll’ because it is being used by another process.

Still happens with the maxcpucount set to 1

If anyone cares to review… https://timewarpenterprises.visualstudio.com/Blazor-State/_build/results?buildId=593 without coverlet they all pass.

1reaction
MarcoRossignolicommented, Jul 28, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot code coverage - Visual Studio
The code coverage analysis tool in Visual Studio collects data for native and managed assemblies (.dll or .exe files). However, in some cases, ......
Read more >
Why dotnet test tool is not creating code coverage report?
Basically I forgot to add the coverlet msbuild NuGet package into my test project. After that, all worked fine with the following command:...
Read more >
Seeing Code Coverage Without Visual Studio Enterprise
Open up Visual Studio 2019 and find the Run Coverlet Report extension in the ... The Run Code Coverage command is on the...
Read more >
On .NET Live - .NET Core Code Coverage with Coverlet
Coverlet is a cross platform code coverage framework for . NET. In this session, we'll have the creator of coverlet Toni Solarin-Sodara join ......
Read more >
How to collect the code coverage of your tests in .NET
Code coverage sometimes is a requirement for your projects and in this ... how you can collect it without relying on Visual Studio...
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