Repository navigation
Fix duplicate data consumer disposal during teardown - #10195
Amaury Levé (Evangelink) merged 1 commit into
Conversation
Track the disposed data consumer rather than the message bus during host teardown so composite extensions are not disposed twice. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 336d2284-26e0-42ed-9772-cf91bc8eeb6b
There was a problem hiding this comment.
Pull request overview
Fixes duplicate disposal of message-bus data consumers during host teardown.
Changes:
- Tracks the disposed consumer instead of the message bus.
- Adds regression coverage for consumers also registered as services.
Show a summary per file
| File | Description |
|---|---|
src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs |
Prevents duplicate consumer disposal. |
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Hosts/CommonHostTests.cs |
Verifies shared consumers are disposed once. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
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
Clean, minimal bug fix with an adequate regression test. The root cause is obvious: alreadyDisposed.Add(service) recorded the message bus instead of the data consumer that was actually disposed and guard-checked, so a data consumer that was also registered as a top-level service would be disposed twice.
Verdict Table
| # | Dimension | Verdict |
|---|---|---|
| 1 | Correctness | ✅ Clean |
| 2 | Edge cases | ✅ Clean |
| 3 | Error handling | N/A |
| 4 | Concurrency / thread-safety | N/A |
| 5 | Performance | ✅ Clean |
| 6 | Security | N/A |
| 7 | Backward compatibility | ✅ Clean |
| 8 | Public API surface | N/A |
| 9 | Naming / readability | ✅ Clean |
| 10 | Code style / conventions | ✅ Clean |
| 11 | Documentation | N/A |
| 12 | Localization | N/A |
| 13 | Test adequacy | ✅ Clean |
| 14 | Test correctness | ✅ Clean |
| 15 | Test maintainability | ✅ Clean |
| 16 | Assertions (banned symbols) | ✅ Clean |
| 17 | Logging / telemetry | N/A |
| 18 | Disposal / resource mgmt | ✅ Clean |
| 19 | Configuration | N/A |
| 20 | CI / build integration | N/A |
| 21 | Dependency management | N/A |
| 22 | Architecture | ✅ Clean |
Overall: No issues found. The one-line fix is correct and the test covers the exact scenario.
🧪 Test quality grade — PR #10195
This advisory comment was generated automatically. Grades are heuristic
|
|
/backport to rel/4.3 |
|
Started backporting to rel/4.3: https://github.com/microsoft/testfx/actions/runs/30096673105 |
…#10195 (backport to rel/4.3) (#10197) Co-authored-by: Amaury Levé <[email protected]> Co-authored-by: Evangelink <[email protected]> Copilot-Session: 336d2284-26e0-42ed-9772-cf91bc8eeb6b
Azure DevOps live result publishing can complete successfully and then crash during host teardown because its composite publisher is disposed twice.
CommonHostdisposed data consumers owned by the message bus but accidentally recorded the message bus itself in the disposed-instance list. This change records the actual consumer, preventing a composite extension that is also registered as a session service from being disposed again. A regression test covers that shared-registration teardown path.Tests:
CommonHostTestsonnet8.0Fixes #10191