-
Notifications
You must be signed in to change notification settings - Fork 391
Description
Describe the bug
I recently upgraded to 6.0.3 and I noticed the pipelines failing. It seems that cobertura.xml comes out empty. I am using a runsettings file with exclude/include. I notice that if I remove these sections the cobertura gets populated.
That said, coverage works fine and cobertura gets entries on 6.0.2 of coverlet.collector nuget package.
To Reproduce
Check out https://github.com/kotsaris/repro-coverlet-empty-cobertura cd into ClassLibrary1 folder and run tests via
dotnet test --collect:"XPlat Code Coverage" --settings .\coverage.runsettings
Expected behavior
It should populate cobertura.xml with something.
Actual behavior
Cobertura.xml is empty.
<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0" branch-rate="0" version="1.9" timestamp="1735730899" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0">
<sources />
<packages />
</coverage>
Restore complete (0.3s)
ClassLibrary1 succeeded (0.1s) → ClassLibrary1\bin\Debug\net9.0\ClassLibrary1.dll
ClassLibrary1.Tests succeeded (0.0s) → ClassLibrary1.Tests\bin\Debug\net9.0\ClassLibrary1.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.0.0+e341b939fe (64-bit .NET 9.0.0)
[xUnit.net 00:00:00.03] Discovering: ClassLibrary1.Tests
[xUnit.net 00:00:00.05] Discovered: ClassLibrary1.Tests
[xUnit.net 00:00:00.06] Starting: ClassLibrary1.Tests
[xUnit.net 00:00:00.08] Finished: ClassLibrary1.Tests
ClassLibrary1.Tests test succeeded (0.7s)
Test summary: total: 1, failed: 0, succeeded: 1, skipped: 0, duration: 0.7s
Build succeeded in 1.2s
Workload updates are available. Run `dotnet workload list` for more information.
Attachments:
C:\dev\kotsaris\repro-coverlet-empty-cobertura\ClassLibrary1\ClassLibrary1.Tests\TestResults\5e5adf4e-c517-478b-a81e-ccff2099c832\coverage.cobertura.xml
Configuration (please complete the following information):
Run Settings:
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>cobertura</Format>
<Exclude>
[*]ClassLibrary1.Tests.*
</Exclude>
<Include>[*]ClassLibrary1*</Include>
<ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute</ExcludeByAttribute>
<SingleHit>false</SingleHit>
<UseSourceLink>false</UseSourceLink>
<IncludeTestAssembly>false</IncludeTestAssembly>
<SkipAutoProps>true</SkipAutoProps>
<DeterministicReport>false</DeterministicReport>
<ExcludeAssembliesWithoutSources>MissingAll,MissingAny,None</ExcludeAssembliesWithoutSources>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? 6.0.3
* Which version of .NET is the code running on? 9
* What OS and version, and what distro if applicable? Windows 11
* What is the architecture (x64, x86, ARM, ARM64)? x64
* Do you know whether it is specific to that configuration? 6.0.2 does not exhibit this
Additional context
Downgrade to 6.0.2 and the problem goes away.
❗ Please also read Known Issues