Coverage buffer that loses its initialization byte is reported as a passing run with an empty report (line-rate="1")
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp
- Lĩnh vực
- testing-qa, tooling
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 125
- Fork
- 17
- Merge trung bình
- 1 giờ 15 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/codecoverage
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
microsoft/codecoverage#252 ·
-
[BUG] Intermittent Windows 0xC0000005 crashes in MTP test hosts with CodeCoverage on .NET 10Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/codecoverage#249 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/codecoverage#220 · 2 bình luận ·
-
False positive branch coverageĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
microsoft/codecoverage#218 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/codecoverage#205 ·
Tất cả issue của microsoft/codecoverage
Issue tương tự
-
test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NethermindEth/nethermind#14274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
area:frontend bug FE P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
klasolsson81/jobbliggaren#2023 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
shimat/opencvsharp#2154 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
subsystem: UI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Open-Systems-Pharmacology/PK-Sim#3812 ·
Maintainer thường phản hồi trong vòng 1 ngày