Skip to content

ci: collect coverage with coverlet's in-proc collector - #289

Merged
MarcelRoozekrans merged 1 commit into
mainfrom
ci/coverlet-inproc-collect
Nov 5, 2026
Merged

MarcelRoozekrans merged 1 commit into
mainfrom
ci/coverlet-inproc-collect

Conversation

@MarcelRoozekrans

Copy link
Copy Markdown
Contributor

Summary

The test step ran dotnet test --settings coverage.runsettings without --collect "XPlat Code Coverage", so whole modules could read 0 coverage at random.

vstest adds coverlet's in-proc collector only when the collect option is given. Without it, nothing writes the hits when the test session ends. Each instrumented module writes them from a ProcessExit handler, and vstest kills a test host that has not exited 100 ms after the run. A module whose handler has not run by then is reported with 0 hits. The same defect was fixed in ZeroAlloc-Net/ZeroAlloc.Outbox#426 and MarcelRoozekrans/BlazorNative#627.

Changes

  • ci.yml: the Test step passes --collect "XPlat Code Coverage" before --settings coverage.runsettings. The runsettings still supply the filters.
  • coverage.runsettings: the header comment names both options and why.

Test Plan

  • CI is green and this PR's Codecov report shows coverage for every module. One green run cannot prove an intermittent fix; the main runs after the merge are the real check.

The test step passed coverage.runsettings to dotnet test but not
--collect "XPlat Code Coverage". vstest only adds coverlet's in-proc
collector for the collect option, so no hits were written when the test
session ended. Each module wrote its hits from a ProcessExit handler
instead, and vstest kills a test host that has not exited 100 ms after
the run. A module whose handler had not run by then was reported with 0
hits.

With both options the in-proc collector writes every module's hits at
session end, and the runsettings still supply the filters. The same
defect was fixed in ZeroAlloc-Net/ZeroAlloc.Outbox#426 and
MarcelRoozekrans/BlazorNative#627.
@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MarcelRoozekrans
MarcelRoozekrans merged commit 551ecf7 into main Nov 5, 2026
16 checks passed
@MarcelRoozekrans
MarcelRoozekrans deleted the ci/coverlet-inproc-collect branch November 5, 2026 05:50
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