Skip to content

Fix code coverage collection on net481 - #44

Merged
tillig merged 1 commit into
developfrom
feature/fix-net481-code-coverage
Aug 31, 2026
Merged

tillig merged 1 commit into
developfrom
feature/fix-net481-code-coverage

Conversation

@tillig

@tillig tillig commented Aug 31, 2026

Copy link
Copy Markdown
Member

Code coverage has not been collected in this repository since coverlet.collector moved past 6.x. Same defect and same fix as autofac/Autofac.Multitenant.Wcf#12.

Proposed Changes

  • Pin coverlet.collector to [6.0.4], the last release shipping netstandard2.0 build assets. Every release from 8.0.0 on ships net8.0 and later only, which a net481 test project cannot consume, so NuGet resolved the package with no build assets at all — coverlet.collector.dll never reached the test output and the XPlat Code Coverage data collector did not exist.
  • Record the constraint at the reference, using exact-version range syntax so a bump has to be deliberate rather than silently dropping coverage again.

Notes

Two things kept this quiet. NuGet does not warn when a package's build assets are framework-incompatible. And the shared ci.yml leaves disable_search off, so codecov logged not_found_files for artifacts/logs/*/coverage.cobertura.xml, searched, found one unrelated file, and uploaded that instead of failing — despite fail_ci_if_error: true. Setting disable_search: true in autofac/.github would turn that into a hard failure across every repo; that is not part of this PR.

Verified locally: restore resolves build assets for net481, the test run produces artifacts/logs/*/coverage.cobertura.xml, and 61 passed / 11 skipped is unchanged (the skips are the Windows-only hosting tests).

coverlet.collector 8.0.0 dropped its netstandard2.0 build assets and ships
net8.0 or later only. A net481 test project cannot consume those, so NuGet
resolved the package with no build assets at all, coverlet.collector.dll
never reached the test output, and the "XPlat Code Coverage" data collector
did not exist:

  Data collection : Unable to find a datacollector with friendly name
  'XPlat Code Coverage'.

Nothing failed the build over it. NuGet does not warn when build assets are
incompatible, and codecov-action has disable_search off, so after not
finding artifacts/logs/*/coverage.cobertura.xml it searched, found one
unrelated file, and uploaded that instead of erroring.

Hold the package at 6.0.4, the last release a .NET Framework test project
can use, and record the constraint at the reference so a future bump does
not quietly break coverage again.
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.42%. Comparing base (0b3b865) to head (d60f2c4).

Additional details and impacted files
@@             Coverage Diff              @@
##           develop      #44       +/-   ##
============================================
+ Coverage         0   80.42%   +80.42%     
============================================
  Files            0       10       +10     
  Lines            0      235      +235     
  Branches         0       67       +67     
============================================
+ Hits             0      189      +189     
- Misses           0       23       +23     
- Partials         0       23       +23     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tillig
tillig merged commit 6d7a343 into develop Aug 31, 2026
12 checks passed
@tillig
tillig deleted the feature/fix-net481-code-coverage branch August 31, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant