Coverlet is a .Net code coverage collector that can be used with MSTest. Use this tags for questions regarding the coverlet collector and it's usage and/or output.
Questions tagged [coverlet]
75 questions
12
votes
3 answers
Can you use Coverlet to get code coverage data in a .NET Framework project?
I have a large .NET Framework solution and want to start collecting code coverage data as part of our build pipeline (as well as on our local developer machines).
On the Coverlet GitHub page it says that it supports .NET Framework projects but all…

Jon Mitchell
- 3,349
- 5
- 27
- 37
11
votes
1 answer
Why dotnet test tool is not creating code coverage report?
My project structure is the following:
.
├── Application
├── Application.Core
├── Application.Domain
├── Application.Tests
├── Application.IntegrationTests
└── README.md
And the command to run my test I use the following input:
dotnet test…

ajr
- 874
- 2
- 13
- 29
10
votes
2 answers
Is it possible to get Code Coverage of .NET Framework Project using coverlet in Azure DevOps?
I easily configured to get the coverage result for .NET Core Projects in Azure DevOps, but no luck with .NET Framework Projects. So, I would be so grateful to get suggestion on this because coverlet documentation is clearly saying that we can also…

BDB
- 429
- 3
- 16
10
votes
2 answers
What is causing "Could not find data collector 'XPlat Code Coverage'" error in Docker image?
I'm setting up a build in DevOps Server that simply runs a docker build, runs a container, and collects test results from it. The Dockerfile uses the mcr.microsoft.com/dotnet/core/sdk:2.2 image as its base, on top of which I've installed powershell.…

memtaus
- 101
- 1
- 1
- 4
8
votes
1 answer
Coverlet lcov.info file not generated for dotnet core project
I'm working on dotnet core project withd VS code inside a linux machine.
following below blog to generate coverage report:
https://www.hanselman.com/blog/AutomaticUnitTestingInNETCorePlusCodeCoverageInVisualStudioCode.aspx
as mentioned there Im…

nari447
- 834
- 2
- 11
- 25
7
votes
3 answers
code coverage in gitlab ci/cd for .net applications?
I recently started working with C# and I am working on one of the legacy system we have. I am trying to figure out what is the code coverage for this legacy system. Here is my Sample.UnitTests.csproj file:
…

dragons
- 549
- 1
- 8
- 24
6
votes
2 answers
Using coverlet with. Net Framework generates an error: The expression "[System.Version]::Parse('')" canot be evaluated
I wrote a very simple C# .Net Framework application and added some unit tests. Now, trying to check the coverage using coverlet. Getting error MSB4184.
The expression "[System.Version]::Parse('')" canot be evaluated. Version string portion was too…

Anel
- 61
- 1
- 2
6
votes
1 answer
Code and details of code coverage not showing in SonarCloud for .Net solution
I have issues seeing details of the code analysis in SonarCloud.
What I have working is a .Net Core application with Coverlet. I do see that the results are uploaded and the coverage shows. However, I don't get to see a dashboard, the tab 'code'…

Blitzoff
- 133
- 4
- 11
5
votes
3 answers
coverlet does not create report in azure devops
I am using
coverlet.msbuild v3.2.0
coverlet.collector v3.2.0
and dotnet sdk v6.0.402
When I run this test command in powershell (restore and build ran before that)
dotnet test --no-build --no-restore --collect:"XPlat Code Coverage"…

mrt181
- 5,080
- 8
- 66
- 86
5
votes
1 answer
How to add [ExcludeFromCodeCoverage] attribute at an assembly-level in a .Net Standard 2.1 project
I have a .Net Core application which has got one .Net Standard 2.1 project in it. I am using Coverlet to get the code coverage in Cobertura format.
I am using "coverlet.msbuild" nuget package in all my Test projects.
I want to add…

Pradeep
- 1,108
- 1
- 15
- 31
5
votes
1 answer
How to exclude method in coverlet coverage report?
How can I exclude a method from code coverage reporting using coverlet and reportgenerator. Excluding entire namespaces in .runsettings works as expected but using [ExcludeFromCodeCoverage] attribute excludes the entire file instead of only the…

Don
- 3,876
- 10
- 47
- 76
4
votes
1 answer
Error when running unit test from console using Visual Studio 17.1
Getting the error below when running the unit test from the command line. This runs fine on Windows 10 machine and is failing in Windows 7.
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --logger…

TrustyCoder
- 4,749
- 10
- 66
- 119
4
votes
1 answer
Module test path not found
I'm trying to configure a GitHub action:
My action contains the job for running the unit test by collecting code coverage. As I see in the log:
Test Run Successful.
Total tests: 336
Passed: 336
Total time: 14.0930 Seconds
Calculating coverage…

Igor Buchelnikov
- 505
- 4
- 14
3
votes
1 answer
exclude code coverage for ef core migration files
I want to exclude all auto generated migration files from code coverage caculation. I can't change the dotnet test command in the build pipeline so I guess my only friend is the [ExcludeFromCodeCoverage] attribute.
The tricky part is that everytime…

lastr2d2
- 3,604
- 2
- 22
- 37
3
votes
1 answer
C# Coverlet results always empty
have .net core 3.1 Microsoft.net.sdk projects, with lots of async xUnit tests.
tried - adding coverlet.msbuild 2.9.0 to the project, and then running:
dotnet test Common\Common.csproj /p:CollectCoverage=true /
got 100% displayed, but an empty…

Darren Oakey
- 2,894
- 3
- 29
- 55