Closed aolszowka closed 9 months ago
Not sure, at least in your example I'm pretty sure it is something different. You have the unit test and the record under test in the same assembly. This doesn't work. coverlet
excludes the test assembly by default and thus in your example the coverage report is completely empty. When you separate the record into another assembly, the current result with coverlet
version 6.0.0 and the most current compiler looks like this:
The roslyn
team changed something in the compiler for records with the release of net8
and that's why in my screenshot you see this uncovered line. If you run an older version of the compiler you probably don't see this.
However we already fixed this with this PR https://github.com/coverlet-coverage/coverlet/pull/1575 which can be consumed with our nightly build.
@daveMueller Yikes, sorry in my haste to create a minimum viable reproducing test case I didn't realize that coverlet excludes the test assembly.
The second part of your comment (the uncovered line) is exactly what we're seeing "in production" and why we were reporting. The fix with #1575 looks like what we want to do, on Monday I'll upgrade to the nightly build and see if that fixes our wagon.
Thank you so much for following up on this so quickly!
@daveMueller I can confirm that the latest nightly fixes the issue "in production" we'll look forward to the latest NuGet Release, thank you again.
Closing as resolved.
Describe the bug Maybe a duplicate of #1576 ? We've been seeing this since we really started looking at our coverage last December but finally got around to a bug report today...
It appears that no coverage is detected for
record
types?To Reproduce Consider the following toy program (Including Azure DevOps Pipeline):
SingleFieldRecord.cs
SingleFieldRecordTests.cs
CodeCoverageSingleFieldNotCovered.csproj
CodeCoverageSingleFieldNotCovered.sln
azurepipeline.yml
Expected behavior When you run this in Azure DevOps Pipeline you'd expect the coverage to get published and it show as 100%
Actual behavior Running the above in Azure DevOps the publish task will fail.
If you crack open the coverage.cobertura.xml you'll see that no coverage was reported:
You can reproduce this locally (No need for Azure DevOps Pipeline) with: