Coverage buffer that loses its initialization byte is reported as a passing run with an empty report (line-rate="1")
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp
- 领域
- testing-qa, tooling
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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. Version 18.11.2 fixed the issue reported there. 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 show that losing the initialization byte, rather than losing probe data, is what makes the module disappear from the report:
| 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" |
Losing the initialization byte hides the data loss. 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.
- 主要语言
- C#
- 星标
- 126
- 派生
- 17
- 平均合并
- 1 小时 15 分钟
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/codecoverage 的其他 Issue
-
难度 5/5 一周以上 新手友好度 10/100
microsoft/codecoverage#255 ·
-
难度 4/5 3-5 天 新手友好度 45/100
microsoft/codecoverage#253 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 65/100
microsoft/codecoverage#252 ·
-
难度 4/5 3-5 天 新手友好度 35/100
microsoft/codecoverage#249 · 1 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 35/100
microsoft/codecoverage#220 · 2 条评论 ·
查看 microsoft/codecoverage 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
nightscout/nocturne#2135 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
Devolutions/UniGetUI#5541 ·
维护者通常 1 天内回复
-
agentic-workflows Needs: Triage :mag:
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
[誤判定]未关闭linux アプリ: ブラウザー 再現済み 要トリアージ 誤判定
难度 2/5 1-3 小时 新手友好度 72/100
yksr-melt/Meltype#853 · 2 条评论 ·
维护者通常 1 天内回复