Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Coverage buffer that loses its initialization byte is reported as a passing run with an empty report (line-rate="1")

Aperta
#251 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/codecoverage

Tutte le issue di microsoft/codecoverage

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.