Add HangDump disposal path tests - #11039
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review. Note You can configure setup steps for Copilot code review separately from Copilot cloud agent with a |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The tracked constructor API baseline is missing, and named-pipe disposal remains unverified.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpProcessLifetimeHandler.cs — This changes a tracked internal constructor signature without updating the API baselines.… |
|
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/HangDumpTests.cs — The happy-path test leaves _namedPipeClient and _singleConnectionNamedPipeServer null, so it… |
What changed in this PR
Adds disposal-path coverage for HangDumpProcessLifetimeHandler, addressing #11024.
Changes:
- Adds configurable disposal timeout.
- Tests synchronous/asynchronous cleanup, failures, timeouts, idempotency, and timer callbacks.
| File | Description |
|---|---|
HangDumpTests.cs |
Adds disposal tests and helpers. |
HangDumpProcessLifetimeHandler.Disposal.cs |
Uses the injected timeout. |
HangDumpProcessLifetimeHandler.cs |
Adds timeout constructor parameter. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Review Summary
| # | Dimension | Verdict |
|---|---|---|
| 1 | Algorithmic Correctness | ✅ Clean |
| 2 | Threading & Concurrency | ✅ Clean |
| 3 | Public API | ✅ Clean — optional parameter with default null preserves all existing call sites |
| 4 | Cross-TFM | ✅ Clean — #if NETCOREAPP guard on the using is correct (only TimeoutAfterAsync needs it) |
| 5 | Performance | ✅ N/A |
| 6 | Error Handling | ✅ Clean |
| 7 | IPC & Serialization | N/A |
| 8 | Localization | N/A |
| 9 | Test Quality | ✅ Clean — good coverage of happy path, timeout, faulted, idempotent, and race-after-gate scenarios |
| 10 | Security | N/A |
| 11 | Naming & Readability | ✅ Clean |
| 12 | Disposable & Lifetime | ✅ Clean |
| 13 | Configuration | N/A |
| 14 | Logging & Telemetry | N/A |
| 15 | Documentation | ✅ Clean |
| 16 | Backward Compatibility | ✅ Clean — optional constructor parameter preserves binary compat for internal type |
| 17 | Build & CI | N/A |
| 18 | Analyzers & Code Fixes | N/A |
| 19 | Dependency Management | N/A |
| 20 | PublicAPI.Unshipped.txt |
✅ N/A — type is internal |
| 21 | Scope Discipline | ✅ Clean — single concern (testable dispose timeout) |
| 22 | init Accessor Ban |
✅ Clean |
Overall: No blocking or major issues found. The change is well-scoped: it makes HangDumpProcessLifetimeHandler's dispose timeout injectable for testing while keeping the production default unchanged, and adds thorough unit tests for every disposal code path.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The asynchronous happy path does not verify resource disposal on a fresh handler.
Review tier: Balanced
Findings: None
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/HangDumpTests.cs — The happy-path test leaves _namedPipeClient and _singleConnectionNamedPipeServer null, so it… View resolved comment |
|
src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpProcessLifetimeHandler.cs — This changes a tracked internal constructor signature without updating the API baselines.… View resolved comment |
Suppressed comments (1)
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/HangDumpTests.cs:686
- This
DisposeAsynccall runs only afterDisposehas already torn down every resource, while the other async tests exit through exception paths before cleanup. Consequently, removing the async named-pipe and wait-handle disposal atHangDumpProcessLifetimeHandler.Disposal.cs:60-62would leave every new test passing. Please add a fresh-handler async happy-path test that populates those resources and verifies they are disposed before using this mixed-call test for idempotency.
await handler.DisposeAsync();
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review. Note You can configure setup steps for Copilot code review separately from Copilot cloud agent with a |
This comment has been minimized.
This comment has been minimized.
🧪 Expert test review — PR #11039
This advisory comment was generated automatically. Grades are heuristic
|
There was a problem hiding this comment.
🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 76.7 AIC · ⌖ 2.72 AIC · ⊞ 16.9K · ◷
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The disposal coverage is comprehensive and deterministic; only minor error-message wording remains.
Review tier: Balanced
Findings: None
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpProcessLifetimeHandler.Disposal.cs:33
TimeSpaninterpolation already renders a duration (for example,00:00:00), so appendingsecondsproduces the confusing message “didn't exit in 00:00:00 seconds”; the new assertion also locks this wording in. FormatTotalSecondswith invariant culture, or remove thesecondssuffix, and update the corresponding test expectation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
🧪 Expert test review — PR #11039
All 9 new tests target the This advisory comment was generated automatically. Grades are heuristic
|
Pipeline Test Triage — Final ResolutionBuild: [1582858]((dev.azure.com/redacted) (completed, result: failed) · Check: SummaryAcross 99 candidate test results (all matrix legs: Linux/macOS/Windows × Debug/Release × net8.0/net462), exactly one test failure was found:
Historical correlation
This pattern (isolated timing-margin failure on a single matrix leg, no reproduction on the same PR's other legs, occasional historical occurrence with mostly-passing history) does not meet the durable issue threshold: it hasn't shown fail-then-pass recovery within the same run, and it hasn't recurred across ≥2 independent main/scheduled builds in immediate succession — it's an intermittent timing-sensitive assertion (6969ms vs a 4000ms bound) most consistent with an environment/agent timing variance on Windows/net462 rather than a deterministic product regression. ConclusionNo durable defect signature established. Not creating an issue at this time — if this failure recurs on additional unrelated builds/commits, or a fail→pass retry pattern emerges, it would meet the flaky-test threshold and warrant an issue with Next step if it recurs: consider loosening the timing assertion margin or adding CTRF retry to distinguish transient scheduler delay from a genuine regression in
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70b84e34-b17c-48cb-b490-05b57c7a74de
🧵 Parallel-safety audit — PR #11039Parallelization — assembly audited:
Under Findings: A (global-state) No unsafe call sites found. The new
The only pre-existing shared state in the production type ( Nothing to flag for parallel-safety in this PR. Advisory only — heuristic, non-blocking. Re-run with
|


HangDumpProcessLifetimeHandlerteardown owns timers, dump coordination, and named-pipe resources, but its synchronous and asynchronous disposal paths had no direct unit coverage.This adds deterministic coverage for cleanup and gate claiming, waiting for in-flight dumps, timeout and fault propagation/reporting, repeated mixed disposal, and late timer callbacks. A constructor-injected internal timeout keeps timeout tests immediate while retaining the existing production default.
Fixes #11024