Running coverlet global tool over dotnet build intermittently fails to open file when calculating coverage
See original GitHub issueIn 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:
- Clone SharpGenTools
- 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:
- Created 4 years ago
- Comments:9
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
-m:1
forces sequential builds using only one coresome infos https://docs.microsoft.com/en-us/visualstudio/msbuild/building-multiple-projects-in-parallel-with-msbuild?view=vs-2019