Skip to content

[candidate/11 sr3] Register HangDump in the TestUtils unit-test host - #41224

Merged
kubaflo merged 1 commit into
candidate/11.0.1xx-sr3from
fix/sr3-testutils-hangdump-register
Dec 4, 2026
Merged

kubaflo merged 1 commit into
candidate/11.0.1xx-sr3from
fix/sr3-testutils-hangdump-register

Conversation

@kubaflo

@kubaflo kubaflo commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 946bedc34f141ef215926b962ba240a7bf31d75e

Dimension Assessment Rationale
Change confidence 9.5/10 ↑ Exact cherry-pick of net11 #41148, whose PR CI passed all four TestUtils runner/validator pairs.
↑ Local sr3 run with CI's exact flags produces a TRX (61 passed, 1 skipped, 0 failed).
↓ sr3 maui-pr CI on this head is still pending.
Diagnosis confidence 10/10 ↑ Causal sequence on sr3 2253c0b: baseline exit 5, fix exit 0, fix reverted exit 5, restored exit 0.
Evidence fit 10/10 ↑ Matches the sr3 maui-pr 1707534 failure (--hangdump ... -p:EnableUnitTestHangDump=true then "exit code: 5. The command-line arguments are invalid") on Windows and macOS.

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Cherry-pick (-x) of net11 #41148 onto candidate/11.0.1xx-sr3.

TestUtils.UnitTests exits before running any tests in sr3 maui-pr 1707534 on Windows and macOS. MTP reports exit 5, "command-line arguments are invalid".

The cause: #41038 passes --hangdump and restores the HangDump package, but this project supplies its own MTP entry point (HeadlessTestRunner). That entry point never registered the HangDump provider, so MTP rejected the flag. The fix registers AddHangDumpProvider() when EnableUnitTestHangDump=true, using the ENABLE_UNIT_TEST_HANG_DUMP define.

Validation

Ran locally on sr3 2253c0bf, with the same flags CI uses:

dotnet test --project src/TestUtils/tests/TestUtils.UnitTests/TestUtils.UnitTests.csproj --configuration Debug --report-trx --hangdump --hangdump-timeout 10m --hangdump-type Mini --results-directory <dir> -p:_SkipUpdateBuildNumber=true -p:EnableUnitTestHangDump=true

State Exit TRX
Baseline (sr3) 5 none
Fix 0 62 total, 61 passed, 1 skipped (Windows-only)
Fix reverted 5 none
Restored 0 62 total, 61 passed, 1 skipped (Windows-only)

Issues Fixed

N/A. This is a candidate CI fix, a port of #41148.

<!-- copilot-assessment:v1 -->
### Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: `7eaf806f7513810dcbd94ca03a1500a5ee4302f4`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 9.5/10 | ↑ [PR CI
1706633](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1706633)
completed with all 33 jobs green, including all four TestUtils runner
and TRX validation pairs.<br>↑ The local suite also runs without the
opt-in; device-host invocation, test selection and pipeline
configuration are unchanged. |
| Diagnosis confidence | 10/10 | ↑ The HangDump package was already
restored, but the custom entry point did not register its provider;
removing only the registration reproduces exit 5, and restoring it
produces a valid TRX. |
| Evidence fit | 10/10 | ↑ The local baseline matched all four
Windows/macOS CI failures, and the same four configurations now execute
tests and validate their TRX with the original HangDump options. |
<!-- /copilot-assessment -->

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

### Description of Change

<!-- Enter description of the fix in this section -->

`TestUtils.UnitTests` exits before running any tests on Windows and
macOS Debug/Release in [net11 maui-pr
1706373](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1706373),
with an invalid-arguments handshake failure (exit 5). #41038 passes
`--hangdump` and restores the HangDump package, but this project
supplies its own MTP entry point, so referencing the package doesn't
register its provider.

Register HangDump in the custom host only when `TestUtils.UnitTests`
builds with `EnableUnitTestHangDump=true`. Leave the diagnostic flags,
ordinary test runs, and device test hosts unchanged.

**Validation:** Ran on macOS arm64 with the repository .NET 11 SDK:

```sh
./.dotnet/dotnet test --project src/TestUtils/tests/TestUtils.UnitTests/TestUtils.UnitTests.csproj --configuration Debug --report-trx --hangdump --hangdump-timeout 10m --hangdump-type Mini -p:_SkipUpdateBuildNumber=true -p:EnableUnitTestHangDump=true --results-directory <results-dir>
```

| Run | Result |
| --- | --- |
| Unchanged net11 with the CI flags | Exit 5, handshake failure, no
tests ran |
| Unchanged net11 without the three HangDump flags, package still
enabled | 61 passed; 1 Windows-only test skipped |
| Fixed Debug with CI flags | 61 passed; 1 skipped; MTP TRX produced |
| Only the registration removed | Exit 5, handshake failure, no tests
ran |
| Registration restored, Debug and Release with CI flags | Each: 61
passed; 1 skipped; MTP TRX produced |
| Fixed Debug without the HangDump flags or opt-in | 61 passed; 1
skipped |

[maui-pr
1706633](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1706633)
completed successfully, with 33 succeeded timeline jobs. All four
targeted runner/validator pairs succeeded. Raw log pairs: macOS Debug
259/260 and Release 240/241 (61 passed, 1 skipped each); Windows Debug
333/334 and Release 367/368 (62 passed each).

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

No separate issue. Fixes the `TestUtils.UnitTests` handshake regression
in #41038.

### Let AI finish this PR

- [ ] **Let the MAUI agent address review feedback and fix remaining
issues on this PR.** Maintainers still decide whether it is merged. For
PRs from forks, the agent opens a follow-up PR that keeps your commits.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 0390753)
@kubaflo

kubaflo commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

@dalexsoto stamp

@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stamping as requested by @kubaflo; no code review performed.

@kubaflo
kubaflo merged commit 4f22dda into candidate/11.0.1xx-sr3 Dec 4, 2026
6 of 15 checks passed
@kubaflo
kubaflo deleted the fix/sr3-testutils-hangdump-register branch December 4, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants