Skip to content

[Windows] Fix CollectionView gesture compilation - #40335

Merged
kubaflo merged 1 commit into
candidate/11.0.1xx-sr2from
kubaflo-psychic-waffle
Nov 17, 2026
Merged

kubaflo merged 1 commit into
candidate/11.0.1xx-sr2from
kubaflo-psychic-waffle

Conversation

@kubaflo

@kubaflo kubaflo commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

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!

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

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.

This is the explicitly coordinated repair of candidate #40116, targeting candidate/11.0.1xx-sr2.

Description of Change

Fix two Windows compilation errors introduced by #39917 in GesturePlatformManager.Windows.cs:

  • OnTap receives RoutedEventArgs, which has no Handled property (CS1061). Use the existing SetHandled(true) extension, as the same method already does for other handled gestures. It dispatches to the right-, single-, and double-tap event argument types.
  • The visual-tree traversal's unqualified ItemsView binds to the MAUI control, not the native WinUI control (CS8121). Explicitly name Microsoft.UI.Xaml.Controls.ItemsView.

The diff is one file and two lines. It preserves the CollectionView bubbling logic and changes no tests, assertions, skips, tolerances, deadlines, SDK/package versions, or pipeline configuration.

Validation

The unchanged candidate reproduces both compiler errors in native build 1685504 and both UI sample builds in 1685501, including their in-job retries.

The exact two-line commit 64e0571f440e392fab4b69178492163c468bba6c was validated by the existing full maui-pr pipeline 1685565. Both completed Windows build jobs report Build succeeded / 0 errors, and their raw logs contain the Controls outputs for both net11.0-windows10.0.19041.0 and net11.0-windows10.0.20348.0.

Exact CI commands, both passed:

D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true

These are the pipeline's existing commands and warning policy, not changed by this PR. Raw build logs: Debug 139, Release 209.

Local file-specific formatting check passed:

.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet

Not an all-green CI claim: the same validation run separately aborts its Windows Release Controls.Core unit-test host in unchanged ViewUnitTests.StartTimerSimple, where overlapping stub timer callbacks call TaskCompletionSource.SetResult twice. That scope writes no result XML. The timer sources are identical on the candidate and this branch; no timer workaround is included here. Runtime/UI gesture behavior was not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no competing correction. The broad open #38822 does not modify this source file.

Issues Fixed

Relates to #40116. Fixes the Windows compilation regression introduced by #39917; no separate issue was filed.

Use the existing RoutedEventArgs.SetHandled helper for tap event subtypes and explicitly reference WinUI ItemsView in native visual-tree traversal. Preserve the CollectionView gesture bubbling logic.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 17, 2026
@kubaflo

kubaflo commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

/rebase

@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@MauiBot

MauiBot commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@kubaflo — existing-test verification; Setup did not capture a tested commit.

Result INCONCLUSIVE Platform Android


🧪 Gate analysis — click to expand

⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect.

No interpretable test-group summary was produced. No additional test execution is inferred.

Setup did not capture a verified PR head; no commit is claimed as tested.

No immutable without-fix baseline was prepared.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 17, 2026
@kubaflo
kubaflo merged commit 12375c0 into candidate/11.0.1xx-sr2 Nov 17, 2026
14 of 55 checks passed
@kubaflo
kubaflo deleted the kubaflo-psychic-waffle branch November 17, 2026 15:08
@kubaflo kubaflo mentioned this pull request Nov 17, 2026
1 task
kubaflo added a commit that referenced this pull request Nov 17, 2026
<!-- 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.

This is the explicitly coordinated candidate #40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in #40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to #40116. Fixes the test-host crash found while validating
#40335; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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.

This is the explicitly coordinated repair of candidate #40116, targeting
`candidate/11.0.1xx-sr2`.

### Description of Change

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

Fix two Windows compilation errors introduced by #39917 in
`GesturePlatformManager.Windows.cs`:

- `OnTap` receives `RoutedEventArgs`, which has no `Handled` property
(`CS1061`). Use the existing `SetHandled(true)` extension, as the same
method already does for other handled gestures. It dispatches to the
right-, single-, and double-tap event argument types.
- The visual-tree traversal's unqualified `ItemsView` binds to the MAUI
control, not the native WinUI control (`CS8121`). Explicitly name
`Microsoft.UI.Xaml.Controls.ItemsView`.

The diff is one file and two lines. It preserves the CollectionView
bubbling logic and changes no tests, assertions, skips, tolerances,
deadlines, SDK/package versions, or pipeline configuration.

**Validation**

The unchanged candidate reproduces both compiler errors in native build
[1685504](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685504)
and both UI sample builds in
[1685501](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685501),
including their in-job retries.

The exact two-line commit `64e0571f440e392fab4b69178492163c468bba6c` was
validated by the existing full `maui-pr` pipeline
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565).
Both completed Windows build jobs report **Build succeeded / 0 errors**,
and their raw logs contain the Controls outputs for **both**
`net11.0-windows10.0.19041.0` and `net11.0-windows10.0.20348.0`.

Exact CI commands, both passed:

```text
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
```

These are the pipeline's existing commands and warning policy, not
changed by this PR. Raw build logs: [Debug
139](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/139?api-version=7.1),
[Release
209](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/209?api-version=7.1).

Local file-specific formatting check passed:

```text
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet
```

**Not an all-green CI claim:** the same validation run separately aborts
its Windows Release Controls.Core unit-test host in unchanged
`ViewUnitTests.StartTimerSimple`, where overlapping stub timer callbacks
call `TaskCompletionSource.SetResult` twice. That scope writes no result
XML. The timer sources are identical on the candidate and this branch;
no timer workaround is included here. Runtime/UI gesture behavior was
not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no
competing correction. The broad open #38822 does not modify this source
file.

### 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. -->

Relates to #40116. Fixes the Windows compilation regression introduced
by #39917; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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.

This is the explicitly coordinated candidate #40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in #40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to #40116. Fixes the test-host crash found while validating
#40335; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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.

This is the explicitly coordinated repair of candidate #40116, targeting
`candidate/11.0.1xx-sr2`.

### Description of Change

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

Fix two Windows compilation errors introduced by #39917 in
`GesturePlatformManager.Windows.cs`:

- `OnTap` receives `RoutedEventArgs`, which has no `Handled` property
(`CS1061`). Use the existing `SetHandled(true)` extension, as the same
method already does for other handled gestures. It dispatches to the
right-, single-, and double-tap event argument types.
- The visual-tree traversal's unqualified `ItemsView` binds to the MAUI
control, not the native WinUI control (`CS8121`). Explicitly name
`Microsoft.UI.Xaml.Controls.ItemsView`.

The diff is one file and two lines. It preserves the CollectionView
bubbling logic and changes no tests, assertions, skips, tolerances,
deadlines, SDK/package versions, or pipeline configuration.

**Validation**

The unchanged candidate reproduces both compiler errors in native build
[1685504](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685504)
and both UI sample builds in
[1685501](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685501),
including their in-job retries.

The exact two-line commit `64e0571f440e392fab4b69178492163c468bba6c` was
validated by the existing full `maui-pr` pipeline
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565).
Both completed Windows build jobs report **Build succeeded / 0 errors**,
and their raw logs contain the Controls outputs for **both**
`net11.0-windows10.0.19041.0` and `net11.0-windows10.0.20348.0`.

Exact CI commands, both passed:

```text
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
```

These are the pipeline's existing commands and warning policy, not
changed by this PR. Raw build logs: [Debug
139](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/139?api-version=7.1),
[Release
209](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/209?api-version=7.1).

Local file-specific formatting check passed:

```text
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet
```

**Not an all-green CI claim:** the same validation run separately aborts
its Windows Release Controls.Core unit-test host in unchanged
`ViewUnitTests.StartTimerSimple`, where overlapping stub timer callbacks
call `TaskCompletionSource.SetResult` twice. That scope writes no result
XML. The timer sources are identical on the candidate and this branch;
no timer workaround is included here. Runtime/UI gesture behavior was
not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no
competing correction. The broad open #38822 does not modify this source
file.

### 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. -->

Relates to #40116. Fixes the Windows compilation regression introduced
by #39917; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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.

This is the explicitly coordinated candidate #40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in #40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to #40116. Fixes the test-host crash found while validating
#40335; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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.

This is the explicitly coordinated repair of candidate #40116, targeting
`candidate/11.0.1xx-sr2`.

### Description of Change

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

Fix two Windows compilation errors introduced by #39917 in
`GesturePlatformManager.Windows.cs`:

- `OnTap` receives `RoutedEventArgs`, which has no `Handled` property
(`CS1061`). Use the existing `SetHandled(true)` extension, as the same
method already does for other handled gestures. It dispatches to the
right-, single-, and double-tap event argument types.
- The visual-tree traversal's unqualified `ItemsView` binds to the MAUI
control, not the native WinUI control (`CS8121`). Explicitly name
`Microsoft.UI.Xaml.Controls.ItemsView`.

The diff is one file and two lines. It preserves the CollectionView
bubbling logic and changes no tests, assertions, skips, tolerances,
deadlines, SDK/package versions, or pipeline configuration.

**Validation**

The unchanged candidate reproduces both compiler errors in native build
[1685504](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685504)
and both UI sample builds in
[1685501](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685501),
including their in-job retries.

The exact two-line commit `64e0571f440e392fab4b69178492163c468bba6c` was
validated by the existing full `maui-pr` pipeline
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565).
Both completed Windows build jobs report **Build succeeded / 0 errors**,
and their raw logs contain the Controls outputs for **both**
`net11.0-windows10.0.19041.0` and `net11.0-windows10.0.20348.0`.

Exact CI commands, both passed:

```text
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
```

These are the pipeline's existing commands and warning policy, not
changed by this PR. Raw build logs: [Debug
139](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/139?api-version=7.1),
[Release
209](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/209?api-version=7.1).

Local file-specific formatting check passed:

```text
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet
```

**Not an all-green CI claim:** the same validation run separately aborts
its Windows Release Controls.Core unit-test host in unchanged
`ViewUnitTests.StartTimerSimple`, where overlapping stub timer callbacks
call `TaskCompletionSource.SetResult` twice. That scope writes no result
XML. The timer sources are identical on the candidate and this branch;
no timer workaround is included here. Runtime/UI gesture behavior was
not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no
competing correction. The broad open #38822 does not modify this source
file.

### 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. -->

Relates to #40116. Fixes the Windows compilation regression introduced
by #39917; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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.

This is the explicitly coordinated candidate #40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in #40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to #40116. Fixes the test-host crash found while validating
#40335; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 19, 2026
<!-- 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.

This is the explicitly coordinated repair of candidate #40116, targeting
`candidate/11.0.1xx-sr2`.

### Description of Change

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

Fix two Windows compilation errors introduced by #39917 in
`GesturePlatformManager.Windows.cs`:

- `OnTap` receives `RoutedEventArgs`, which has no `Handled` property
(`CS1061`). Use the existing `SetHandled(true)` extension, as the same
method already does for other handled gestures. It dispatches to the
right-, single-, and double-tap event argument types.
- The visual-tree traversal's unqualified `ItemsView` binds to the MAUI
control, not the native WinUI control (`CS8121`). Explicitly name
`Microsoft.UI.Xaml.Controls.ItemsView`.

The diff is one file and two lines. It preserves the CollectionView
bubbling logic and changes no tests, assertions, skips, tolerances,
deadlines, SDK/package versions, or pipeline configuration.

**Validation**

The unchanged candidate reproduces both compiler errors in native build
[1685504](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685504)
and both UI sample builds in
[1685501](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685501),
including their in-job retries.

The exact two-line commit `64e0571f440e392fab4b69178492163c468bba6c` was
validated by the existing full `maui-pr` pipeline
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565).
Both completed Windows build jobs report **Build succeeded / 0 errors**,
and their raw logs contain the Controls outputs for **both**
`net11.0-windows10.0.19041.0` and `net11.0-windows10.0.20348.0`.

Exact CI commands, both passed:

```text
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
```

These are the pipeline's existing commands and warning policy, not
changed by this PR. Raw build logs: [Debug
139](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/139?api-version=7.1),
[Release
209](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/209?api-version=7.1).

Local file-specific formatting check passed:

```text
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet
```

**Not an all-green CI claim:** the same validation run separately aborts
its Windows Release Controls.Core unit-test host in unchanged
`ViewUnitTests.StartTimerSimple`, where overlapping stub timer callbacks
call `TaskCompletionSource.SetResult` twice. That scope writes no result
XML. The timer sources are identical on the candidate and this branch;
no timer workaround is included here. Runtime/UI gesture behavior was
not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no
competing correction. The broad open #38822 does not modify this source
file.

### 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. -->

Relates to #40116. Fixes the Windows compilation regression introduced
by #39917; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 19, 2026
<!-- 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.

This is the explicitly coordinated candidate #40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in #40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to #40116. Fixes the test-host crash found while validating
#40335; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 22, 2026
<!-- 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.

This is the explicitly coordinated repair of candidate #40116, targeting
`candidate/11.0.1xx-sr2`.

### Description of Change

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

Fix two Windows compilation errors introduced by #39917 in
`GesturePlatformManager.Windows.cs`:

- `OnTap` receives `RoutedEventArgs`, which has no `Handled` property
(`CS1061`). Use the existing `SetHandled(true)` extension, as the same
method already does for other handled gestures. It dispatches to the
right-, single-, and double-tap event argument types.
- The visual-tree traversal's unqualified `ItemsView` binds to the MAUI
control, not the native WinUI control (`CS8121`). Explicitly name
`Microsoft.UI.Xaml.Controls.ItemsView`.

The diff is one file and two lines. It preserves the CollectionView
bubbling logic and changes no tests, assertions, skips, tolerances,
deadlines, SDK/package versions, or pipeline configuration.

**Validation**

The unchanged candidate reproduces both compiler errors in native build
[1685504](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685504)
and both UI sample builds in
[1685501](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685501),
including their in-job retries.

The exact two-line commit `64e0571f440e392fab4b69178492163c468bba6c` was
validated by the existing full `maui-pr` pipeline
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565).
Both completed Windows build jobs report **Build succeeded / 0 errors**,
and their raw logs contain the Controls outputs for **both**
`net11.0-windows10.0.19041.0` and `net11.0-windows10.0.20348.0`.

Exact CI commands, both passed:

```text
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
```

These are the pipeline's existing commands and warning policy, not
changed by this PR. Raw build logs: [Debug
139](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/139?api-version=7.1),
[Release
209](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/209?api-version=7.1).

Local file-specific formatting check passed:

```text
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet
```

**Not an all-green CI claim:** the same validation run separately aborts
its Windows Release Controls.Core unit-test host in unchanged
`ViewUnitTests.StartTimerSimple`, where overlapping stub timer callbacks
call `TaskCompletionSource.SetResult` twice. That scope writes no result
XML. The timer sources are identical on the candidate and this branch;
no timer workaround is included here. Runtime/UI gesture behavior was
not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no
competing correction. The broad open #38822 does not modify this source
file.

### 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. -->

Relates to #40116. Fixes the Windows compilation regression introduced
by #39917; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 22, 2026
<!-- 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.

This is the explicitly coordinated candidate #40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in #40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to #40116. Fixes the test-host crash found while validating
#40335; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 23, 2026
<!-- 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.

This is the explicitly coordinated repair of candidate #40116, targeting
`candidate/11.0.1xx-sr2`.

### Description of Change

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

Fix two Windows compilation errors introduced by #39917 in
`GesturePlatformManager.Windows.cs`:

- `OnTap` receives `RoutedEventArgs`, which has no `Handled` property
(`CS1061`). Use the existing `SetHandled(true)` extension, as the same
method already does for other handled gestures. It dispatches to the
right-, single-, and double-tap event argument types.
- The visual-tree traversal's unqualified `ItemsView` binds to the MAUI
control, not the native WinUI control (`CS8121`). Explicitly name
`Microsoft.UI.Xaml.Controls.ItemsView`.

The diff is one file and two lines. It preserves the CollectionView
bubbling logic and changes no tests, assertions, skips, tolerances,
deadlines, SDK/package versions, or pipeline configuration.

**Validation**

The unchanged candidate reproduces both compiler errors in native build
[1685504](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685504)
and both UI sample builds in
[1685501](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685501),
including their in-job retries.

The exact two-line commit `64e0571f440e392fab4b69178492163c468bba6c` was
validated by the existing full `maui-pr` pipeline
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565).
Both completed Windows build jobs report **Build succeeded / 0 errors**,
and their raw logs contain the Controls outputs for **both**
`net11.0-windows10.0.19041.0` and `net11.0-windows10.0.20348.0`.

Exact CI commands, both passed:

```text
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
```

These are the pipeline's existing commands and warning policy, not
changed by this PR. Raw build logs: [Debug
139](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/139?api-version=7.1),
[Release
209](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/209?api-version=7.1).

Local file-specific formatting check passed:

```text
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet
```

**Not an all-green CI claim:** the same validation run separately aborts
its Windows Release Controls.Core unit-test host in unchanged
`ViewUnitTests.StartTimerSimple`, where overlapping stub timer callbacks
call `TaskCompletionSource.SetResult` twice. That scope writes no result
XML. The timer sources are identical on the candidate and this branch;
no timer workaround is included here. Runtime/UI gesture behavior was
not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no
competing correction. The broad open #38822 does not modify this source
file.

### 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. -->

Relates to #40116. Fixes the Windows compilation regression introduced
by #39917; no separate issue was filed.

<!--
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>
kubaflo added a commit that referenced this pull request Nov 23, 2026
<!-- 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.

This is the explicitly coordinated candidate #40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in #40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to #40116. Fixes the test-host crash found while validating
#40335; no separate issue was filed.

<!--
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>
@kubaflo kubaflo added this to the .NET 11 SR2 milestone Nov 24, 2026
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Nov 26, 2026
<!-- 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.

This is the explicitly coordinated repair of candidate dotnet#40116, targeting
`candidate/11.0.1xx-sr2`.

### Description of Change

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

Fix two Windows compilation errors introduced by dotnet#39917 in
`GesturePlatformManager.Windows.cs`:

- `OnTap` receives `RoutedEventArgs`, which has no `Handled` property
(`CS1061`). Use the existing `SetHandled(true)` extension, as the same
method already does for other handled gestures. It dispatches to the
right-, single-, and double-tap event argument types.
- The visual-tree traversal's unqualified `ItemsView` binds to the MAUI
control, not the native WinUI control (`CS8121`). Explicitly name
`Microsoft.UI.Xaml.Controls.ItemsView`.

The diff is one file and two lines. It preserves the CollectionView
bubbling logic and changes no tests, assertions, skips, tolerances,
deadlines, SDK/package versions, or pipeline configuration.

**Validation**

The unchanged candidate reproduces both compiler errors in native build
[1685504](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685504)
and both UI sample builds in
[1685501](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685501),
including their in-job retries.

The exact two-line commit `64e0571f440e392fab4b69178492163c468bba6c` was
validated by the existing full `maui-pr` pipeline
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565).
Both completed Windows build jobs report **Build succeeded / 0 errors**,
and their raw logs contain the Controls outputs for **both**
`net11.0-windows10.0.19041.0` and `net11.0-windows10.0.20348.0`.

Exact CI commands, both passed:

```text
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Debug /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Debug/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
D:\a\_work\1\s\build.cmd -ci -restore -build -configuration Release /p:ArchiveTests=false /p:TreatWarningsAsErrors=false /p:SkipInitInternalTooling=true /bl:D:\a\_work\1\s/artifacts/log/Release/build_Windows.binlog /p:OfficialBuildId=20261117.89 /p:_SkipUpdateBuildNumber=true
```

These are the pipeline's existing commands and warning policy, not
changed by this PR. Raw build logs: [Debug
139](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/139?api-version=7.1),
[Release
209](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1685565/logs/209?api-version=7.1).

Local file-specific formatting check passed:

```text
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs --exclude Templates/src --exclude-diagnostics CA1822 --verify-no-changes --verbosity quiet
```

**Not an all-green CI claim:** the same validation run separately aborts
its Windows Release Controls.Core unit-test host in unchanged
`ViewUnitTests.StartTimerSimple`, where overlapping stub timer callbacks
call `TaskCompletionSource.SetResult` twice. That scope writes no result
XML. The timer sources are identical on the candidate and this branch;
no timer workaround is included here. Runtime/UI gesture behavior was
not newly exercised by this compilation repair.

Upstream open/recently merged exact-mechanism searches found no
competing correction. The broad open dotnet#38822 does not modify this source
file.

### 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. -->

Relates to dotnet#40116. Fixes the Windows compilation regression introduced
by dotnet#39917; no separate issue was filed.

<!--
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>
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Nov 26, 2026
<!-- 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.

This is the explicitly coordinated candidate dotnet#40116 test-infrastructure
repair, targeting `candidate/11.0.1xx-sr2`. It is independent of the
Windows compilation correction in dotnet#40335.

### Description of Change

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

The Windows Release Controls.Core unit-test host in
[1685565](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685565)
aborted before writing its XML results:

```text
InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
TaskCompletionSource<bool>.SetResult
ViewUnitTests.StartTimerSimple:505
DispatcherExtensions.StartTimer.OnTick:120
DispatcherTimerStub.OnTimeout:83
```

`DispatcherTimerStub` uses a periodic `System.Threading.Timer`. The
default test dispatcher invokes callbacks inline on ThreadPool threads,
so multiple ticks can run concurrently. `StartTimer` removes its handler
and stops only after the callback returns `false`; a synchronous
continuation inside the first `SetResult` can leave time for another
tick to invoke the callback again.

Serialize the **dispatched** tick callbacks with a per-timer lock and
check that the timer is still running before invoking a queued tick. Use
the same lock when starting or stopping. This models a dispatcher's
sequential callback execution and prevents an already-queued tick from
running after the first callback stops the timer.

Add `CreateTimerQueuedCallbacksDoNotOverlapOrRunAfterStop` to the
existing Core dispatcher tests. It captures two actual queued timer
callbacks, starts them on separate threads, holds the first callback,
and verifies that the second neither overlaps it nor fires after `Stop`.
Both worker tasks are joined in cleanup.

No shipping dispatcher code changes. `ViewUnitTests.StartTimerSimple`
and `StartTimerMultiple`, including their `SetResult`, assertions and
intervals, are unchanged. No exception suppression, `TrySetResult`,
skip, retry-budget, timeout, dependency-version, or pipeline change.

**Validation**

Using the repository-pinned .NET SDK `11.0.101-servicing.26559.106`:

- The prescribed verifier reports **`VERIFICATION PASSED`**: the
dispatcher class is **9 passed / 1 failed without the stub fix**, with
the new test failing `Assert.False` on an overlapping tick; **10 passed
/ 0 failed with it**. The script restored the committed worktree itself.
- Full Release Core suite: **1,126 passed**. Full Release Controls.Core
suite: **6,816 passed, 30 existing skips**. Original method/outcome
multiplicities match the retained candidate results, with only the new
Core regression case added. Both original timer tests pass unchanged.
- Full Debug Core suite: **1,126 passed**. The separate full Debug
Controls invocation was blocked before tests by an unavailable
`GeneratePublicApiFiles` task in its Maps dependency; it is **not**
claimed as a pass. No analyzer was disabled.
- An exact-source managed diagnostic that previously reproduced the
CI-shaped duplicate `SetResult` crash also passes with the actual fixed
stub. This is controlled interleaving evidence, not a claim that the
original CI scheduler was instrumented.
- After pushing the exact commit, these commands passed again:

```bash
dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter FullyQualifiedName~DispatcherTests -v:quiet
# Passed: 10, Failed: 0

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -c Release -f net11.0 --no-build --no-restore --filter 'FullyQualifiedName~StartTimerSimple|FullyQualifiedName~StartTimerMultiple' -v:quiet
# Passed: 2, Failed: 0
```

The verifier command was:

```powershell
$PSDefaultParameterValues["EstablishBrokenBaseline.ps1:BaseBranch"] = "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b"
& ./.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -TestType UnitTest -FixFiles @("src/Core/tests/UnitTests/TestClasses/DispatcherStub.cs") -BaseBranch "5cfa4f4cbb3d1f099a26f0db8a3f511437077d2b" -PRNumber "timer-local-autodetect" -RequireFullVerification
```

The command-local PowerShell default preserves the same explicit frozen
SHA through the existing dot-sourced helper; no verification script was
edited. An earlier explicit-filter invocation was blocked because the
runner did not resolve its unit project; it restored the worktree and is
not counted as behavioral verification.

Local test runs used `DOTNET_MODIFIABLE_ASSEMBLIES=debug`,
`LANG=en_US.UTF-8`, and `LC_ALL=en_US.UTF-8`. Build invocations selected
only plain .NET targets through the existing
`Include*TargetFrameworks=false` command-line properties. File-specific
formatting and `git diff --check` passed.

The original crashed CI scope has no result XML; its 6,846 cases remain
unmeasured in that run. Local results do not retroactively mark it,
other platforms, or the whole candidate green.

### 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. -->

Relates to dotnet#40116. Fixes the test-host crash found while validating
dotnet#40335; no separate issue was filed.

<!--
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>

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 64e0571f Deployed Nov 17, 2026 by kubaflo via conclusion #3041
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