Coverage buffer that loses its initialization byte is reported as a passing run with an empty report (line-rate="1")
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- csharp
- Ambito
- testing-qa, tooling
Direzione di ricerca
Start by tracing SharedMemoryStream.IsInitialized() through the collector path described in the issue, including the guards around AddPackage, AddStream, and PopulateCoverageStatus. Reproduce the offset-0 corruption using the harness and results linked from issue #232. Done means an uninitialized module buffer is made visible as an anomaly rather than producing a passing empty report that satisfies coverage thresholds.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Package: Microsoft.Testing.Extensions.CodeCoverage 18.11.2 (the latest at the time of writing)
Runtime: .NET 8 and .NET 10 hosts, Linux x64, xunit.v3 3.2.2 on Microsoft.Testing.Platform
Context: split out of #232, which 18.11.2 fixed. The harness and full results are in this comment.
Summary
If a module's coverage buffer loses its initialization byte, the run is reported as Passed! and the cobertura report is 178 bytes, with line-rate="1" over an empty <packages />. A coverage threshold passes it, so the data loss goes unnoticed.
Cause
The byte at offset 0 of the buffer is read by SharedMemoryStream.IsInitialized(). It gates whether a module enters the report at all: if (logStream.IsInitialized()) guards AddPackage, AddStream and PopulateCoverageStatus. Truncating the buffer zeroes that byte, and the host's flush writes only the indices where a probe fired, so index 0 is never restored.
Two runs isolate it to that byte, rather than to the data loss itself:
| what was done to the buffer | cobertura |
|---|---|
| write a single zero byte to offset 0; file length and all 1,356 probe bytes left intact | 178 bytes, line-rate="1" |
truncate to 0, re-extend to the original length, then set offset 0 back to 1 |
337,297 bytes, line-rate="0.027" |
The direction matters. When the flag survives, the report shows a low rate that honestly reflects the destroyed data, and any coverage threshold catches it. When the flag is lost, the report shows a perfect rate over zero lines, which every threshold passes.
Suggestion
The collector created the buffer and handed it to the host, so a module whose buffer comes back uninitialized is an anomaly it can detect, not a normal skip. Logging a warning at that point, or failing the coverage step, would make this loss visible.
- Lingua principale
- C#
- Stelle
- 125
- Fork
- 17
- Merge medio
- 1h 15m
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/codecoverage
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
microsoft/codecoverage#253 · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
microsoft/codecoverage#252 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
microsoft/codecoverage#249 · 1 commento · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
microsoft/codecoverage#220 · 2 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
microsoft/codecoverage#218 ·
Tutte le issue di microsoft/codecoverage
Issue simili
-
[i18n] 安装实例完成后的成功提示未正确本地化Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
PCL-Community/PCL-CE#3658 ·
I maintainer di solito rispondono entro 1 giorno
-
Deploy & Patch-issues opprettes ikke: create-pnd-issues.yml har feilet hver uke siden 2025-09-08Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Altinn/altinn-auth#4359 ·
I maintainer di solito rispondono entro 1 giorno
-
アプリ: チャット 優先: 中 提案
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
yksr-melt/Meltype#243 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Workflows: a workflow stored with null conditions is skipped with an exception instead of runApertabug core
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
type/automation type/tech-debt
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno