Skip to content

[Windows] Fix CollectionView (CV1) crash when replacing ItemsSource - #40654

Draft
praveenkumarkarunanithi wants to merge 9 commits into
dotnet:net11from
praveenkumarkarunanithi:fix-40193
Draft

praveenkumarkarunanithi wants to merge 9 commits into
dotnet:net11from
praveenkumarkarunanithi:fix-40193

Conversation

@praveenkumarkarunanithi

Copy link
Copy Markdown
Contributor

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 PR addresses a Windows CV1 CollectionView crash when repeatedly replacing an ItemsSource containing shadowed items.

Root Cause

CV1 disconnected old item handlers while their shadow wrappers were still held by native item containers. The crash was observed during handler disconnection; the exact native failure remains unconfirmed.

Description of Change

  • Release the old item container content before disconnecting its handlers.
  • Add a Windows CV1 device test that verifies the old shadow wrapper is released when ItemsSource is replaced.

Issues Fixed

Fixes #40193

Tested the behavior in the following platforms

  • Windows - CV1
  • Android
  • iOS
  • Mac

Output

Before Fix After Fix
BeforeFix.mp4
AfterFix.mp4

kubaflo and others added 8 commits November 22, 2026 19:06
…path (APT2260) (dotnet#40406)

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

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

### Target Branch

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

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

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

### Description of Change

Build infrastructure only; no product or test code changes.

**Symptom.** Windows `Pack` (and occasionally `Build`) jobs fail
intermittently with `APT2260` in `Controls.Xaml` `net11.0-android37.0`
`Aapt2Link`: `style attribute 'attr/colorPrimary' not found` and other
Material attributes. Recent examples are net11 maui-pr
[1688582](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1688582)
and candidate maui-pr
[1688577](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1688577).
There have been 6 Pack and 2 Build Windows failures since 15 Nov, across
branches.

**Root cause.** `eng/Build.props` restores
`Microsoft.Maui.BuildTasks.slnf` with `BuildTaskOnlyBuild=true` first,
then the full solution filter, in the same MSBuild process:
1. Under CI, `BuildTaskOnlyBuild=true` disables the all-TFM group in
`Directory.Build.props`. The first restore therefore writes a reduced
`artifacts/obj/<project>/<project>.csproj.nuget.g.props/targets`, with
import groups only for `netstandard2.0`, `netstandard2.1` and `net11.0`.
2. The full restore's evaluations parse those same files into the
in-process `ProjectRootElementCache`, then rewrite them with all TFMs.
3. That cache does not revalidate timestamps: it is created with
`autoReloadFromDisk: false`, keeps 200 strong MRU entries and holds the
rest weakly. Later build evaluations can reuse the stale reduced XML, so
platform TFMs lose their `buildTransitive` package imports, including
the Material `AndroidAarLibrary` items. That produces `APT2260`. Whether
the stale entry survives depends on cache eviction and GC, which is why
the failure is intermittent.

CI binlogs show this directly. In failing build 1688582, the build-phase
evaluations of `Controls.Xaml` (ios/android/windows), `Controls.Core`
(ios/windows) and `Graphics` (android/windows) have zero package imports
from the `nuget.g.targets`. Passing net11 build
[1687936](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1687936)
has the normal import counts. dotnet#39779 serialized the two restores
(`RestoreInParallel=false`) but they still shared these generated files.
dotnet#40206 worked around the same mechanism for `Controls.Core` with
explicit package references.

**Fix.** For the build-task restore only, `Directory.Build.props` sets
`MSBuildProjectExtensionsPath` to
`$(BaseIntermediateOutputPath)buildtasks\`, so that restore writes
`nuget.g.*`, `project.assets.json` and dgspec files under
`artifacts/obj/<project>/buildtasks/`. The full restore and build keep
the default `artifacts/obj/<project>/` path, and the full restore's
evaluations never read the reduced files. Arcade's `ProjectLayout.props`
sets only `BaseIntermediateOutputPath`, and `Microsoft.Common.props`
defaults `MSBuildProjectExtensionsPath` after importing
`Directory.Build.props`, so this is the supported place to set it.
Nothing in the repo reads these paths directly. Other
`BuildTaskOnlyBuild` callers (`eng/cake/dotnet.cake`,
`eng/pipelines/arcade/setup-test-env.yml`) restore before every later
build, so they also stop overwriting the full assets. The comment in
`eng/Build.props` is updated to match.

Rejected alternatives:
- `MSBUILDNOINPROCNODE=1`: pipeline-wide behaviour change.
- More explicit package references, as in dotnet#40206: a per-project
workaround that doesn't remove the shared state.
- Disabling project-extension imports: unsafe.

### Validation

All runs used SDK 11.0.100 with `dotnet msbuild -m:1 -nodeReuse:false`.

**Minimal standalone repro.** A local package with `build/net10.0`
targets, consumed by a library whose TFMs shrink from `net11.0;net10.0`
to `net11.0` under `BuildTaskOnlyBuild=true`. The driver runs the
reduced restore, then the full restore, then reads the package marker
for `net10.0`:

| Run | Result |
| --- | --- |
| Baseline | marker missing (red) |
| Fix | marker present (green) |
| Fix reverted | marker missing (red) |
| Fix restored | marker present (green) |
| Control: baseline with `MSBUILDNOINPROCNODE=1` | marker present
(green): the in-proc XML cache is the mechanism |

**Repo-level repro, in Arcade's order.** The driver runs a
`BuildTasks.slnf` restore with `BuildTaskOnlyBuild=true`, then a full
`Controls.Xaml` restore, then an evaluation of `Controls.Xaml`
`net11.0-android37.0` that counts `AndroidAarLibrary` items. All runs
used `CI=true -p:IncludeMacOSTargetFrameworks=false`.
`MSBUILDPROJECTROOTELEMENTCACHESIZE=100000` stops strong-cache eviction,
which makes the CI intermittency deterministic:

| Run | AndroidAarLibrary (all / Material) | Package imports in the
build-phase android evaluation |
| --- | --- | --- |
| Baseline | 0 / 0 (red) | 31: the stale reduced `nuget.g.targets` |
| Fix | 69 / 1 (green) | 133 |
| Fix reverted | 0 / 0 (red) | — |
| Fix restored | 69 / 1 (green) | — |

With default cache settings the baseline was green locally (69/1), which
is consistent with the eviction-dependent intermittency seen in CI.

**Other checks.**
- Evaluation with `BuildTaskOnlyBuild=true`:
`MSBuildProjectExtensionsPath`, `RestoreOutputPath` and
`ProjectAssetsFile` point at `artifacts/obj/Controls.Xaml/buildtasks/`.
Without it they stay at `artifacts/obj/Controls.Xaml/`.
- `CI=true dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug
-p:BuildTaskOnlyBuild=true -p:IncludeMacOSTargetFrameworks=false`: build
succeeded, 0 warnings. All 12 restored projects wrote their assets under
`artifacts/obj/<project>/buildtasks/`.

The CI proof will be a Pack run's Windows binlog: the full restore's
evaluations should no longer import a normal-path `nuget.g.targets`
written by the build-task restore.

### Issues Fixed

Intermittent Windows Pack/Build `APT2260` failures in maui-pr. No issue
is filed; this was found while triaging dotnet#40116 CI.

Fixes #

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…net#40412)

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

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

### Target Branch

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

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

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

### Description of Change

Test-only. On Android, `App.DismissKeyboard()` calls Appium's
`hideKeyboard`. That sends ESC, and if the IME is still reported as
shown about a second later, it also sends BACK. When the IME hide takes
longer than that, BACK closes the test page's `MainActivity` and the
launcher comes to the front. The next element lookup then throws a
`NullReferenceException` or times out.

This is the same mechanism as dotnet#40361 (Issue35119). There, BACK cancelled
a prompt.

The fix replaces the three Android `DismissKeyboard()` calls in
`Issue28986_ContentPage` (`SafeAreaPerEdgeValidation`,
`SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle`) and
`Issue28986.SafeAreaPerEdgeValidation` with a helper:
- It waits for the keyboard to show.
- It sends only ESC, which the visible IME consumes.
- It asserts that the keyboard hides.

iOS still calls `DismissKeyboard()`. No assertions, tolerances or
baselines change. The keyboard tests in
`Issue28986_SafeAreaBorderOrientation` are excluded on Android
(`TEST_FAILS_ON_ANDROID`), so they are unchanged.

**CI evidence.** Candidate UI 1689104, SafeAreaEdges API36 (log 2836):
- The original attempt hit an NRE in `Tap("GridResetAllButton")` at line
156, right after `DismissKeyboard()` and a passing
`WaitForKeyboardToHide()`.
- Logcat shows ESC to Gboard, then the app's `onRequestHide`, then
`onHidden` after a stalled IME dump. Then a `Transition CLOSE` for the
app task brings the launcher to the front.
- The same NRE@156 signature appears in UI builds 1687709 and 1687330.

**Local causal validation.** Android 16 (API 36) emulator, `net11`
Material3 HostApp APK from UI build 1688901, filter
`Name=SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle|Name=SafeAreaPerEdgeValidation`
(3 tests per run):

| Phase | Runs | Failed tests |
| --- | --- | --- |
| Baseline (`net11`) | 3 | 9/9 |
| Fixed | 3 | 1/9 |
| Fix reverted | 3 | 6/9 |
| Fix restored | 3 | 1/9 |

- Baseline failures match CI: NRE at `Issue28986_ContentPage.cs:156`
(4), timeout at line 105 (4), a failure at line 126 (1), and timeout in
`Issue28986.cs` at line 193 (6). Each comes after ESC, then `onHidden`,
then a mid-test `Transition CLOSE` of the uitests task. The app
relaunches only after the timeout.
- Both fixed-run failures are in
`Issue28986_ContentPage.SafeAreaPerEdgeValidation` at line 121. That is
the earlier "keyboard shown" assertion, before any hide. Logcat shows no
`onRequestShow` in those runs, so the keyboard was never requested. This
is a separate, pre-hide failure that this PR doesn't address.

### Issues Fixed

Fixes CI flakiness in
`Issue28986_ContentPage.SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle`,
`Issue28986_ContentPage.SafeAreaPerEdgeValidation` and
`Issue28986.SafeAreaPerEdgeValidation` on Android.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…t#40409)

This pull request updates the following dependencies

[marker]: <> (Begin:fc4a0e63-cc9b-414d-9375-11dd045dcfa9)
## From https://github.com/dotnet/android
- **Subscription**:
[fc4a0e63-cc9b-414d-9375-11dd045dcfa9](https://maestro.dot.net/subscriptions?search=fc4a0e63-cc9b-414d-9375-11dd045dcfa9)
- **Build**:
[11.0.1xx-d644ae60c9c7cff27a9813663298c3aa642534a3-1](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=16070009)
([342149](https://maestro.dot.net/channel/8298/github:dotnet:android/build/342149))
- **Date Produced**: November 18, 2026 9:02:56 PM UTC
- **Commit**:
[d644ae60c9c7cff27a9813663298c3aa642534a3](dotnet/android@d644ae6)
- **Branch**:
[release/11.0.1xx](https://github.com/dotnet/android/tree/release/11.0.1xx)

[DependencyUpdate]: <> (Begin)

- **Dependency Updates**:
  - From [37.2.40 to 37.2.43][1]
     - Microsoft.Android.Sdk.Windows

[1]: dotnet/android@37b3691...d644ae6

[DependencyUpdate]: <> (End)


[marker]: <> (End:fc4a0e63-cc9b-414d-9375-11dd045dcfa9)



[marker]: <> (Begin:0340b3ac-0154-4d65-98b8-f534ebc24108)
## From https://github.com/dotnet/dotnet
- **Subscription**:
[0340b3ac-0154-4d65-98b8-f534ebc24108](https://maestro.dot.net/subscriptions?search=0340b3ac-0154-4d65-98b8-f534ebc24108)
- **Build**:
[20261117.5](https://dev.azure.com/dnceng/internal/_build/results?buildId=3138553)
([342028](https://maestro.dot.net/channel/8298/github:dotnet:dotnet/build/342028))
- **Date Produced**: November 18, 2026 7:22:18 AM UTC
- **Commit**:
[81e781b0429cbad5d1984bce95e451bba6aeab0e](dotnet/dotnet@81e781b)
- **Branch**:
[release/11.0.1xx](https://github.com/dotnet/dotnet/tree/release/11.0.1xx)

[DependencyUpdate]: <> (Begin)

- **Dependency Updates**:
  - From [11.0.1 to 11.0.1][2]
     - Microsoft.AspNetCore.Authentication.Facebook
     - Microsoft.AspNetCore.Authentication.Google
     - Microsoft.AspNetCore.Authentication.MicrosoftAccount
     - Microsoft.AspNetCore.Authorization
     - Microsoft.AspNetCore.Components
     - Microsoft.AspNetCore.Components.Analyzers
     - Microsoft.AspNetCore.Components.Forms
     - Microsoft.AspNetCore.Components.Web
     - Microsoft.AspNetCore.Components.WebAssembly
     - Microsoft.AspNetCore.Components.WebAssembly.Server
     - Microsoft.AspNetCore.Components.WebView
     - Microsoft.AspNetCore.Metadata
     - Microsoft.Extensions.Configuration
     - Microsoft.Extensions.Configuration.Abstractions
     - Microsoft.Extensions.Configuration.Json
     - Microsoft.Extensions.DependencyInjection
     - Microsoft.Extensions.DependencyInjection.Abstractions
     - Microsoft.Extensions.FileProviders.Abstractions
     - Microsoft.Extensions.Hosting.Abstractions
     - Microsoft.Extensions.Logging
     - Microsoft.Extensions.Logging.Abstractions
     - Microsoft.Extensions.Logging.Console
     - Microsoft.Extensions.Logging.Debug
     - Microsoft.Extensions.Primitives
     - Microsoft.JSInterop
     - Microsoft.NETCore.App.Ref
  - From [11.0.0-beta.26566.116 to 11.0.0-beta.26567.105][2]
     - Microsoft.DotNet.Arcade.Sdk
     - Microsoft.DotNet.Build.Tasks.Feed
     - Microsoft.DotNet.Build.Tasks.Installers
     - Microsoft.DotNet.Build.Tasks.Workloads
     - Microsoft.DotNet.Helix.JobMonitor
     - Microsoft.DotNet.Helix.Sdk
     - Microsoft.DotNet.RemoteExecutor
     - Microsoft.DotNet.SharedFramework.Sdk
     - Microsoft.DotNet.XUnitExtensions
- From [11.0.101-servicing.26566.116 to 11.0.101-servicing.26567.105][2]
     - Microsoft.NET.Sdk

[2]: dotnet/dotnet@f41eb11...81e781b

[DependencyUpdate]: <> (End)


[marker]: <> (End:0340b3ac-0154-4d65-98b8-f534ebc24108)

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
…r/DragLeave (dotnet#40441)

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

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

### Target Branch

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

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

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

### Description of Change

On iOS, `DragEventArgs.GetPosition()` can throw a
`NullReferenceException` inside a `DragOver` or `DragLeave` handler. The
exception crashes the app.

**CI evidence.** The `DropEventCoordinates` UI test crashed the HostApp
on both attempts on the iOS CoreCLR lane of SR2 candidate dotnet#40116
(maui-pr-uitests
[1690394](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1690394),
iOS latest Editor..Fr job). The job's `.ips` reports show SIGABRT from
`xamarin_process_managed_exception` under `-[UIDropInteraction
_dragDestinationGestureStateChanged:]`. The logarchive shows the managed
exception:

```
System.NullReferenceException
  at DragAndDropDelegate.CalculatePosition(IElement, WeakReference, WeakReference)
  at DragAndDropBetweenLayouts.OnDragOver(...)        // HostApp calls e.GetPosition(...)
  at DragAndDropDelegate.<HandleDragOver>...
  at DragAndDropDelegate.SendEventArgs(...)
  at DragAndDropDelegate.HandleDragOver(...)
  at DragAndDropDelegate.SessionDidUpdate(...)
```

**Root cause.**
- `SessionDidUpdate` and `SessionDidExit` pass
`session.LocalDragSession`, a transient managed wrapper of the native
local drag session, into `HandleDragOver` and `HandleDragLeave`.
- Those methods put only a `WeakReference` to it in the `GetPosition`
callback, and nothing else on the path keeps it alive:
`PlatformDragEventArgs` holds the outer `IUIDropSession`, not the local
drag session.
- A GC while the user's handler is running can therefore collect the
wrapper. `CalculatePosition` then calls `LocationInView` on a null
session.
- Separately, `HandleDragOver` built a weak reference even when
`LocalDragSession` is null (a drag from another app), so `GetPosition`
always threw in that case. `HandleDragLeave` and `HandleDrop` already
return null there.

The weak references date from 2023, and the code is identical on
`net11`, the candidate and `main`. This is a latent bug that the CoreCLR
lane's GC timing exposed, not a candidate regression.

**Fix** (`DragAndDropDelegate.cs`, iOS/Mac Catalyst):
- `HandleDragOver` and `HandleDragLeave` call `GC.KeepAlive(session)`
after dispatching to the recognizers. The session stays alive while
handlers can synchronously call `GetPosition`, and the event args still
don't hold it strongly.
- `HandleDragOver` uses a null `sessionRef` when there is no local drag
session, matching `HandleDragLeave` and `HandleDrop`.
- `CalculatePosition` returns `null` when the session reference is
missing or its target has already been collected, instead of
dereferencing null. This covers a `GetPosition` call made after the
handler returns.

**Tests** (`DragAndDropTests.iOS.cs`, `Gesture` category):
- `DragPositionIsAvailableAfterGarbageCollectionDuringHandler(dragLeave:
false/true)`: a fake drop session returns a fresh local drag session
wrapper each time, the handler forces a full GC and then calls
`GetPosition`, and the test asserts the fake session's location.
- `DragOverPositionIsNullWithoutLocalDragSession`: with no local drag
session, `GetPosition` in `DragOver` returns `null`.

**Validation** (iOS 18.5 simulator, Release, CoreCLR, the same runtime
as the failing CI lane):

| Command | Result |
| --- | --- |
| `pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1
-Project Controls -Platform ios -TestFilter "Category=Gesture"
-DeviceUdid <iOS 18.5 sim> -SkipXcodeVersionCheck` with only the new
tests (no fix) | **Failed**: 45 passed, 3 failed. All three new cases
throw `NullReferenceException` at
`DragAndDropDelegate.CalculatePosition`, the same frame as the CI crash.
|
| Same command with the fix | **Passed**: 48 passed, 0 failed |
| `dotnet format whitespace --folder --include <changed files>
--verify-no-changes` | Passed |

The UI test itself was not rerun locally, because its crash depends on
when a GC happens.

### Issues Fixed

No existing issue; found while investigating SR2 candidate dotnet#40116 CI.
Searched for related issues and PRs and found no duplicate.
dotnet#28416/dotnet#28417 is an unrelated Mac Catalyst `DragAndDropDelegate` NRE.

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

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@vishnumenon2684

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

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

This is test infrastructure for the .NET 12 (`main`) line, so it targets
`main`.

### Description of Change

Migrate all repository test execution from **Helix + XHarness** to plain
**`dotnet test`** on **Microsoft.Testing.Platform (MTP)**.

This PR carries the migration from #39918 (by @mattleibow, commits
preserved) brought up to date with current `main` (.NET 12 SDK, `/review
run-device-tests`, recent product and test fixes), plus the follow-up
fixes needed to make it build and pass on .NET 12.

#### Why we need this

- **One way to run tests, everywhere.** Today unit tests run through
Arcade's Helix SDK (`eng/helix.proj`), device tests through Helix +
XHarness (`eng/helix_xharness.proj`), Appium tests through Cake, and
locally through yet other scripts. After this change the same command —
`dotnet test --project <test project>` (plus `--device` for mobile) —
runs every suite on a developer machine, in CI, and in the Copilot
review gate. A CI failure can be reproduced locally with the exact
command CI used.
- **Remove a fragile, opaque layer.** Helix/XHarness add payload
zipping, remote queues, a job monitor, custom work-item scripts and a
separate result path. Many recurring device-test infra failures
(XHarness exit 78/80/83 `APP_LAUNCH_FAILURE`/`APP_CRASH`, Helix jobs
never scheduled, stale or missing `testResults.xml`, queue/image drift
such as XHarness requiring an iPhone 11 Pro device type that iOS 27.1+
no longer ships) come from that layer, not from MAUI. Direct execution
on the agent gives real logs, real exit codes and the actual device in
the job.
- **Genuine, trustworthy results.** Every suite now produces the test
framework's own TRX via MTP (`--report-trx`), and empty selections or
missing reports fail the job instead of silently passing. On Android/iOS
the native app's own TRX is collected and reconciled with the host
proxy, so a crash cannot be reported as a pass.
- **Modern test stack.** xUnit v2 + VSTest + XHarness test runners are
replaced by **xUnit v3 + MTP**, which is what the .NET SDK `dotnet test`
and device (`--device`) support is built on. This unblocks newer xUnit
features (`TestContext`, cancellation, `Assert.Skip*`) and keeps us on
the path the SDK supports directly.
- **Fewer moving parts to maintain.** Removes `eng/helix.proj`,
`eng/helix_xharness.proj`, the Helix pipeline stages, the XHarness CLI
tool, and the XHarness/Helix package dependencies.

#### What changes

- **Unit tests**: all repository xUnit suites move to xUnit v3 (`4.0.2`)
on MTP (`2.5.1`); `global.json` selects `Microsoft.Testing.Platform` as
the `dotnet test` runner. CI (`stage-unit-tests.yml`) runs each project
with `dotnet test --project … --report-trx` on Windows and macOS (Debug
and Release) and validates the TRX
(`eng/scripts/Assert-TestResults.ps1`). Helix unit-test stages are
removed.
- **Device tests** (Controls, Core, Graphics, Essentials,
BlazorWebView): the XHarness/visual runners are replaced by native MTP
hosts — Android instrumentation, the normal Apple MAUI app/scene
lifecycle, and an owned Windows MSIX/unpackaged launcher.
`maui-pr-devicetests` runs them directly on device-capable agents
(`stage-device-tests.yml`, `device-tests-steps.yml`) with job-owned
emulators/simulators.
- **UI tests (Appium)** stay on NUnit, now hosted on MTP with matching
fixture-failure, retry and attachment handling.
- **Integration tests** run with `dotnet test`; legacy `--filter`
selectors are translated to MTP filters. iOS template apps are launched
with `simctl` on a dedicated simulator instead of XHarness.
- **Local tooling** (`Run-DeviceTests.ps1`, Cake, review-gate scripts,
skills/instructions) updated to the same direct commands.

#### Changes made while bringing #39918 onto current `main`

- Merged `main` (.NET 12 move #40060, `/review run-device-tests` #40545,
review-gate removal #40595, and other fixes) and resolved 23 conflicts.
- **`/review run-device-tests` selection ported** to the direct
template: `ci-device-tests.yml` passes
`selectedRun`/`selectedPlatforms`/`selectedProjects`/`selectedFilters`,
and `stage-device-tests.yml` runs only the selected platforms and
projects with the selected category skip-lists. Verified with the AzDO
YAML preview API (full run: 28 jobs; a sample selection of Android+iOS /
Controls+Essentials with `SkipCategories=Shell,Label`: exactly 4 jobs
with that filter). `eng/helix_xharness.proj` is no longer a trusted
dispatch path.
- **Device tests default to `net12.0` and CoreCLR only** — the .NET 12
mobile workloads no longer provide Mono (same as #40060).
- Took main's Switch hover-resource fix (#40209) over the PR's earlier
variant; kept the HybridWebView asset-ownership change together with
main's `DynamicDependency`.
- Ported main's UI-test retry recovery rules (#40407) into the shared
`UITestRetry.cs` used by Cake and MTP.
- Dropped the XHarness-only simulator runtime selection
(`SelectLatestIOSVersion`) and its tests; runtime/device-type selection
is covered by `SimulatorTests`.

#### Fixes found by running CI / locally after the merge

- **xUnit v3 adaptation of tests added on `main`**:
`TestContext.Current.CancellationToken` (xUnit1051), source-info
constructor for `WindowsFact` (xUnit3003); `UITest.NUnit.Tests` and the
Windows launcher build for the repo TFM instead of `net11.0`.
- **Async-void / inline continuation differences in xUnit v3** (v2's
`AsyncTestSyncContext` hid them):
- `ListProxyTests.SynchronizedCollectionAdd` leaked thread-static
dispatcher options onto a thread-pool thread, so later tests got a
dispatcher that always required dispatch (68 Storyboard failures in
macOS Release). Restored after use; fixtures reset the options.
- Shell tests resumed inline from `Navigated`, so the *next* tests ran
inside Shell's navigation callback and had their implicit routes reset
(`DeferPopNavigation(Pop)`). Verified locally by detecting
`FireNavigatedEvents` on the next test's stack before/after the change.
- **Native runner thread affinity** (test bodies run on the thread pool,
not the UI thread as under XHarness):
`WillTerminateDestroysMainPageWindowOnce` resolved the `Application` off
the UI thread; the CarouselView leak test posted a UIKit notification
off the UI thread.
- **iOS simulator selection**: only use device types that the runtime
lists (device-specific iOS 27.1 builds only accept one, causing
`SimError 403 Incompatible device`), and prefer the iPhone 11 Pro
profile XHarness used (Shell flyout header geometry tests from #39877
fail on Dynamic Island phones; passes on iPhone 11 Pro, fails on iPhone
16 — reproduced locally).
- **Mac Catalyst**: `dotnet test` starts the app executable directly, so
unlike `open`/XHarness it isn't activated; activate it before running
(animated CarouselView scrolls intermittently never finished).
- **Integration tests**: shut down build servers after installing the
test workloads — reused MSBuild nodes kept a stale workload resolver and
nested `UseWorkload=true` sample builds failed with NU1015 (reproduced
locally; Samples macOS now passes in CI). The Android `maui-blazor` +
`TrimMode=full` row is skipped explicitly: the previous runner silently
dropped `TrimMode`, and Blazor does not support full trimming
(dotnet/aspnetcore#63951).
- **Windows `HybridWebView` disconnect** NRE when `CoreWebView2` is not
(or no longer) initialized — exposed by the new fixture teardown that
disconnects every handler.
- Docs spellcheck word, and a template boolean comparison so the device
stage doesn't expand to zero jobs.
- **UI-test retry reconciliation**: when a fixture's `OneTimeSetUp`
fails, NUnit reports its `[Ignore]`d tests as failed and the retry
reports them skipped. MTP's TRX names classes of fixtures with arguments
(every UI-test fixture, e.g. `EditorFeatureTests(Windows)`) by namespace
only, so the ignored tests were never matched as recovered and the job
failed although the retry passed. Replaying the real CI TRX/NUnit
reports reproduces the failure before the fix and merges cleanly after
it; `FixtureRecoveryReconcilesIgnoredTestsInParameterizedFixtures`
covers it.
- **iOS CarouselView test timing** (`Animated ScrollTo Does Not Report
Positions It Passes Over`, failed on every native CI run, passed under
Helix): with logging, every failing run showed a still-queued
initial-position pass scrolling back to page 0 without animation,
cancelling the test's animated `ScrollTo`. Under the native runner the
test can resume between those queued passes. The test now lets them
drain; full-class cold runs went from 2/9 failing to 5/5 passing, and it
passes in CI.
- **`main` build breaks from re-enabled CA1416** (#40663): carried the
fixes from #40708 (merged) and #40720
(`UISettings.AnimationsEnabledChanged` in `PlatformTicker` and
`MotionPolicy` requires Windows 10.0.19041). The Windows errors only
surfaced one project at a time because `Core` references `Essentials`.

### Validation

Local (macOS arm64, .NET SDK `12.0.100-alpha.1.26523.103`, Debug,
`dotnet test --project <csproj> --report-trx`):

| Project | Result |
| --- | --- |
| Controls.Xaml.UnitTests | 2,327 passed, 8 skipped |
| Controls.Core.UnitTests | 7,453 passed, 30 skipped |
| Controls.BindingSourceGen.UnitTests | 135 passed |
| SourceGen.UnitTests | 997 passed |
| Core.UnitTests | 1,147 passed |
| Resizetizer.UnitTests | 795 passed, 3 skipped |
| Essentials.UnitTests | 520 passed |
| Essentials.ExternalBackend.UnitTests | 6 passed |
| Graphics.Tests | 406 passed |
| VisualTestUtils.MagickNet.Tests | 13 passed |
| MauiBlazorWebView.UnitTests | 70 passed |
| MauiBlazorWebView.ExternalHandler.UnitTests | 52 passed |
| UITest.NUnit.Tests | 50 passed, 5 skipped |
| TestUtils.UnitTests | 61 passed, 1 skipped |

Pester (pipeline/runner scripts): `Direct-TestDevice`, `Cake-Mtp`,
`RunTests`, `NUnitMtp`, `XunitMtp`, `Run-DeviceTests`,
`WindowsTestPackage`, `Assert-TestResults`, `CopilotPipeline`,
`Review-PR`, `Verify-TestsFail`, `BuildAndRunHostApp`, `Review-Tests`,
`Recover-MissedReviewCommands`: 600+ passed. The only remaining failure
(`handles qualified selections in every stage guard`, expects 10 vs 11)
also fails on `main` and is unrelated.

Note:
`StoryboardTests.StoppingFromPropertyChangingDuringATakeoverRaisesOnePairOfNotifications`
(added on `main`) is culture-sensitive and fails under a comma-decimal
locale on `main` as well; it passes under `en-US` as in CI.

#### CI

Every pipeline was run with `/azp run` on this PR and on validation-only
drafts:
- #40703: this PR's changes on `net11`.
- #40705: the #40703 changes plus sample PRs #40696, #40660, #40654 and
#40691, to check that tests added by other PRs run under the native
runners.
- #40706: this PR plus sample PR #40669.

Failures were compared against `main`/`net11` Helix baselines by test
name.

| Pipeline | This PR (`main`) | `net11` validation (#40703 / #40705) |
| --- | --- | --- |
| `maui-pr` (build, pack, unit tests, integration) | ✅ 35/35 jobs (with
the CA1416 fixes) | ✅ 33/33 jobs |
| `maui-pr-devicetests` | ✅ Android, iOS, Mac Catalyst except
`PageTransitions` tests that fail identically in `main`'s Helix runs | ✅
Android, iOS, Mac Catalyst; only intermittent single-test failures that
don't repeat across runs |
| `maui-pr-uitests` (Appium on MTP) | ✅ 133/134 jobs; the only failure,
WinUI `SharedElementLandsAndSourceIsRestoredAfterPop`, also fails on
`main`'s Helix runs | ✅ 130/133; see below |

Remaining UI-test failures on `net11`, none of them regressions:
- `DragAndDropWithAnElementThatIsRemoved` (Mac Catalyst) fails in 2 of
the last 10 `net11` Helix runs too.
- The RefreshView tests failed only on #40705, which includes
RefreshView sample PR #40660.
- The `vlatest` shard failed because the agent couldn't download the iOS
18.5 simulator runtime.
- Material3 (API 36) screenshots in the last two runs came out 87 px
taller. #40603, merged on `net11` yesterday, now crops by the status-bar
height that Appium reports. The same tree and emulator setup passed
430/433 in the two previous runs.

**Known remaining device-test blockers (from #39918, not regressions of
this merge):** packaged Windows MSIX installation is rejected with
`0x800B0109` (the temporary signer is not a trusted root on the agent
image — needs owner-provided signing/provisioning), and the Windows
Controls unpackaged suite can terminate with `0xDEAD` after ~350 tests
(native composition resource exhaustion investigated in #39918).

### Issues Fixed

No product issue. Supersedes/continues #39918.

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 28, 2026
…[net11]

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

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

This is test infrastructure for the .NET 12 (`main`) line, so it targets
`main`.

Migrate all repository test execution from **Helix + XHarness** to plain
**`dotnet test`** on **Microsoft.Testing.Platform (MTP)**.

This PR carries the migration from #39918 (by @mattleibow, commits
preserved) brought up to date with current `main` (.NET 12 SDK, `/review
run-device-tests`, recent product and test fixes), plus the follow-up
fixes needed to make it build and pass on .NET 12.

- **One way to run tests, everywhere.** Today unit tests run through
Arcade's Helix SDK (`eng/helix.proj`), device tests through Helix +
XHarness (`eng/helix_xharness.proj`), Appium tests through Cake, and
locally through yet other scripts. After this change the same command —
`dotnet test --project <test project>` (plus `--device` for mobile) —
runs every suite on a developer machine, in CI, and in the Copilot
review gate. A CI failure can be reproduced locally with the exact
command CI used.
- **Remove a fragile, opaque layer.** Helix/XHarness add payload
zipping, remote queues, a job monitor, custom work-item scripts and a
separate result path. Many recurring device-test infra failures
(XHarness exit 78/80/83 `APP_LAUNCH_FAILURE`/`APP_CRASH`, Helix jobs
never scheduled, stale or missing `testResults.xml`, queue/image drift
such as XHarness requiring an iPhone 11 Pro device type that iOS 27.1+
no longer ships) come from that layer, not from MAUI. Direct execution
on the agent gives real logs, real exit codes and the actual device in
the job.
- **Genuine, trustworthy results.** Every suite now produces the test
framework's own TRX via MTP (`--report-trx`), and empty selections or
missing reports fail the job instead of silently passing. On Android/iOS
the native app's own TRX is collected and reconciled with the host
proxy, so a crash cannot be reported as a pass.
- **Modern test stack.** xUnit v2 + VSTest + XHarness test runners are
replaced by **xUnit v3 + MTP**, which is what the .NET SDK `dotnet test`
and device (`--device`) support is built on. This unblocks newer xUnit
features (`TestContext`, cancellation, `Assert.Skip*`) and keeps us on
the path the SDK supports directly.
- **Fewer moving parts to maintain.** Removes `eng/helix.proj`,
`eng/helix_xharness.proj`, the Helix pipeline stages, the XHarness CLI
tool, and the XHarness/Helix package dependencies.

- **Unit tests**: all repository xUnit suites move to xUnit v3 (`4.0.2`)
on MTP (`2.5.1`); `global.json` selects `Microsoft.Testing.Platform` as
the `dotnet test` runner. CI (`stage-unit-tests.yml`) runs each project
with `dotnet test --project … --report-trx` on Windows and macOS (Debug
and Release) and validates the TRX
(`eng/scripts/Assert-TestResults.ps1`). Helix unit-test stages are
removed.
- **Device tests** (Controls, Core, Graphics, Essentials,
BlazorWebView): the XHarness/visual runners are replaced by native MTP
hosts — Android instrumentation, the normal Apple MAUI app/scene
lifecycle, and an owned Windows MSIX/unpackaged launcher.
`maui-pr-devicetests` runs them directly on device-capable agents
(`stage-device-tests.yml`, `device-tests-steps.yml`) with job-owned
emulators/simulators.
- **UI tests (Appium)** stay on NUnit, now hosted on MTP with matching
fixture-failure, retry and attachment handling.
- **Integration tests** run with `dotnet test`; legacy `--filter`
selectors are translated to MTP filters. iOS template apps are launched
with `simctl` on a dedicated simulator instead of XHarness.
- **Local tooling** (`Run-DeviceTests.ps1`, Cake, review-gate scripts,
skills/instructions) updated to the same direct commands.

- Merged `main` (.NET 12 move #40060, `/review run-device-tests` #40545,
review-gate removal #40595, and other fixes) and resolved 23 conflicts.
- **`/review run-device-tests` selection ported** to the direct
template: `ci-device-tests.yml` passes
`selectedRun`/`selectedPlatforms`/`selectedProjects`/`selectedFilters`,
and `stage-device-tests.yml` runs only the selected platforms and
projects with the selected category skip-lists. Verified with the AzDO
YAML preview API (full run: 28 jobs; a sample selection of Android+iOS /
Controls+Essentials with `SkipCategories=Shell,Label`: exactly 4 jobs
with that filter). `eng/helix_xharness.proj` is no longer a trusted
dispatch path.
- **Device tests default to `net12.0` and CoreCLR only** — the .NET 12
mobile workloads no longer provide Mono (same as #40060).
- Took main's Switch hover-resource fix (#40209) over the PR's earlier
variant; kept the HybridWebView asset-ownership change together with
main's `DynamicDependency`.
- Ported main's UI-test retry recovery rules (#40407) into the shared
`UITestRetry.cs` used by Cake and MTP.
- Dropped the XHarness-only simulator runtime selection
(`SelectLatestIOSVersion`) and its tests; runtime/device-type selection
is covered by `SimulatorTests`.

- **xUnit v3 adaptation of tests added on `main`**:
`TestContext.Current.CancellationToken` (xUnit1051), source-info
constructor for `WindowsFact` (xUnit3003); `UITest.NUnit.Tests` and the
Windows launcher build for the repo TFM instead of `net11.0`.
- **Async-void / inline continuation differences in xUnit v3** (v2's
`AsyncTestSyncContext` hid them):
- `ListProxyTests.SynchronizedCollectionAdd` leaked thread-static
dispatcher options onto a thread-pool thread, so later tests got a
dispatcher that always required dispatch (68 Storyboard failures in
macOS Release). Restored after use; fixtures reset the options.
- Shell tests resumed inline from `Navigated`, so the *next* tests ran
inside Shell's navigation callback and had their implicit routes reset
(`DeferPopNavigation(Pop)`). Verified locally by detecting
`FireNavigatedEvents` on the next test's stack before/after the change.
- **Native runner thread affinity** (test bodies run on the thread pool,
not the UI thread as under XHarness):
`WillTerminateDestroysMainPageWindowOnce` resolved the `Application` off
the UI thread; the CarouselView leak test posted a UIKit notification
off the UI thread.
- **iOS simulator selection**: only use device types that the runtime
lists (device-specific iOS 27.1 builds only accept one, causing
`SimError 403 Incompatible device`), and prefer the iPhone 11 Pro
profile XHarness used (Shell flyout header geometry tests from #39877
fail on Dynamic Island phones; passes on iPhone 11 Pro, fails on iPhone
16 — reproduced locally).
- **Mac Catalyst**: `dotnet test` starts the app executable directly, so
unlike `open`/XHarness it isn't activated; activate it before running
(animated CarouselView scrolls intermittently never finished).
- **Integration tests**: shut down build servers after installing the
test workloads — reused MSBuild nodes kept a stale workload resolver and
nested `UseWorkload=true` sample builds failed with NU1015 (reproduced
locally; Samples macOS now passes in CI). The Android `maui-blazor` +
`TrimMode=full` row is skipped explicitly: the previous runner silently
dropped `TrimMode`, and Blazor does not support full trimming
(dotnet/aspnetcore#63951).
- **Windows `HybridWebView` disconnect** NRE when `CoreWebView2` is not
(or no longer) initialized — exposed by the new fixture teardown that
disconnects every handler.
- Docs spellcheck word, and a template boolean comparison so the device
stage doesn't expand to zero jobs.
- **UI-test retry reconciliation**: when a fixture's `OneTimeSetUp`
fails, NUnit reports its `[Ignore]`d tests as failed and the retry
reports them skipped. MTP's TRX names classes of fixtures with arguments
(every UI-test fixture, e.g. `EditorFeatureTests(Windows)`) by namespace
only, so the ignored tests were never matched as recovered and the job
failed although the retry passed. Replaying the real CI TRX/NUnit
reports reproduces the failure before the fix and merges cleanly after
it; `FixtureRecoveryReconcilesIgnoredTestsInParameterizedFixtures`
covers it.
- **iOS CarouselView test timing** (`Animated ScrollTo Does Not Report
Positions It Passes Over`, failed on every native CI run, passed under
Helix): with logging, every failing run showed a still-queued
initial-position pass scrolling back to page 0 without animation,
cancelling the test's animated `ScrollTo`. Under the native runner the
test can resume between those queued passes. The test now lets them
drain; full-class cold runs went from 2/9 failing to 5/5 passing, and it
passes in CI.
- **`main` build breaks from re-enabled CA1416** (#40663): carried the
fixes from #40708 (merged) and #40720
(`UISettings.AnimationsEnabledChanged` in `PlatformTicker` and
`MotionPolicy` requires Windows 10.0.19041). The Windows errors only
surfaced one project at a time because `Core` references `Essentials`.

Local (macOS arm64, .NET SDK `12.0.100-alpha.1.26523.103`, Debug,
`dotnet test --project <csproj> --report-trx`):

| Project | Result |
| --- | --- |
| Controls.Xaml.UnitTests | 2,327 passed, 8 skipped |
| Controls.Core.UnitTests | 7,453 passed, 30 skipped |
| Controls.BindingSourceGen.UnitTests | 135 passed |
| SourceGen.UnitTests | 997 passed |
| Core.UnitTests | 1,147 passed |
| Resizetizer.UnitTests | 795 passed, 3 skipped |
| Essentials.UnitTests | 520 passed |
| Essentials.ExternalBackend.UnitTests | 6 passed |
| Graphics.Tests | 406 passed |
| VisualTestUtils.MagickNet.Tests | 13 passed |
| MauiBlazorWebView.UnitTests | 70 passed |
| MauiBlazorWebView.ExternalHandler.UnitTests | 52 passed |
| UITest.NUnit.Tests | 50 passed, 5 skipped |
| TestUtils.UnitTests | 61 passed, 1 skipped |

Pester (pipeline/runner scripts): `Direct-TestDevice`, `Cake-Mtp`,
`RunTests`, `NUnitMtp`, `XunitMtp`, `Run-DeviceTests`,
`WindowsTestPackage`, `Assert-TestResults`, `CopilotPipeline`,
`Review-PR`, `Verify-TestsFail`, `BuildAndRunHostApp`, `Review-Tests`,
`Recover-MissedReviewCommands`: 600+ passed. The only remaining failure
(`handles qualified selections in every stage guard`, expects 10 vs 11)
also fails on `main` and is unrelated.

Note:
`StoryboardTests.StoppingFromPropertyChangingDuringATakeoverRaisesOnePairOfNotifications`
(added on `main`) is culture-sensitive and fails under a comma-decimal
locale on `main` as well; it passes under `en-US` as in CI.

Every pipeline was run with `/azp run` on this PR and on validation-only
drafts:
- #40703: this PR's changes on `net11`.
- #40705: the #40703 changes plus sample PRs #40696, #40660, #40654 and
runners.
- #40706: this PR plus sample PR #40669.

Failures were compared against `main`/`net11` Helix baselines by test
name.

| Pipeline | This PR (`main`) | `net11` validation (#40703 / #40705) |
| --- | --- | --- |
| `maui-pr` (build, pack, unit tests, integration) | ✅ 35/35 jobs (with
the CA1416 fixes) | ✅ 33/33 jobs |
| `maui-pr-devicetests` | ✅ Android, iOS, Mac Catalyst except
`PageTransitions` tests that fail identically in `main`'s Helix runs | ✅
Android, iOS, Mac Catalyst; only intermittent single-test failures that
don't repeat across runs |
| `maui-pr-uitests` (Appium on MTP) | ✅ 133/134 jobs; the only failure,
WinUI `SharedElementLandsAndSourceIsRestoredAfterPop`, also fails on
`main`'s Helix runs | ✅ 130/133; see below |

Remaining UI-test failures on `net11`, none of them regressions:
- `DragAndDropWithAnElementThatIsRemoved` (Mac Catalyst) fails in 2 of
the last 10 `net11` Helix runs too.
- The RefreshView tests failed only on #40705, which includes
RefreshView sample PR #40660.
- The `vlatest` shard failed because the agent couldn't download the iOS
18.5 simulator runtime.
- Material3 (API 36) screenshots in the last two runs came out 87 px
taller. #40603, merged on `net11` yesterday, now crops by the status-bar
height that Appium reports. The same tree and emulator setup passed
430/433 in the two previous runs.

**Known remaining device-test blockers (from #39918, not regressions of
this merge):** packaged Windows MSIX installation is rejected with
`0x800B0109` (the temporary signer is not a trusted root on the agent
image — needs owner-provided signing/provisioning), and the Windows
Controls unpackaged suite can terminate with `0xDEAD` after ~350 tests
(native composition resource exhaustion investigated in #39918).

No product issue. Supersedes/continues #39918.

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit b5108cd)

net11 adaptation: net11.0 TFM, CoreCLR + Mono device-test runtimes and net11's Arcade SDK version, matching validation PR #40703. SourceGen tests for .NET 12-only features are not brought over.

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

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it label Dec 1, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress label Dec 1, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — 1 finding

Reviewed commit b45dd23.

See inline comments for details.

@github-actions github-actions Bot added s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Dec 1, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress and removed s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) labels Dec 1, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — No more findings

Reviewed commit f5c3966.

@github-actions github-actions Bot added s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Selected Tests

Result NOT QUEUED Platforms Windows Tests 8 UI, 2 device Commit f5c39660


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ❌ not queued 8 of 77 categories —
Device tests ❌ not queued 2 of 105 units —
🧪 UI tests — CarouselView, CollectionView1, CollectionView2, CollectionView3 +4 on Windows

❌ Could not queue maui-pr-uitests: Azure Pipelines did not start maui-pr-uitests for the dispatch branch run-tests/pr40654-46558853544 within 10 minutes. Comment /review run-tests again, or use /azp run maui-pr-uitests for the full suite.

GPT-6.2 Sol: Run Windows CollectionView and CarouselView UI tests for the items-handler cleanup change.
MAI Code 2: Windows CV1 ItemsView handler fix; run CollectionView and CarouselView UI tests on Windows.

🧪 Running — 8 categories on Windows

Platform Categories
Windows CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7
🧪 Device tests — Controls.CarouselView, Controls.CollectionView on Windows

❌ Could not queue maui-pr-devicetests: Azure Pipelines did not start maui-pr-devicetests for the dispatch branch run-devicetests/pr40654-46558853544 within 10 minutes. Comment /review run-tests again, or use /azp run maui-pr-devicetests for the full suite.

GPT-6.2 Sol: Run Windows Controls device tests for CollectionView regressions and shared CarouselView cleanup.
MAI Code 2: Windows CV1 device fix; run Controls CollectionView and CarouselView device tests on Windows.

🧪 Running — 2 categories on Windows

Platform Categories
Windows Controls.CarouselView, Controls.CollectionView
⏭️ Skipped — what neither suite runs

UI tests — 69 categories, 3 platforms

Platforms not run: Android, iOS, MacCatalyst

Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, BoxView, Brush, Button, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DisplayPrompt, DragAndDrop, Entry, Editor, Effects, Essentials, FlyoutPage, Focus, Fonts, Frame, Gestures, GraphicsView, Image, ImageButton, IndicatorView, InputTransparent, IsEnabled, IsVisible, Label, Layout, Lifecycle, ManualReview, Maps, Navigation, Page, Performance, Picker, ProgressBar, RadioButton, RefreshView, SafeAreaEdges, Shadow, ScrollView, SearchBar, Shape, Slider, SoftInput, Stepper, Switch, SwipeView, Shell1, Shell2, TabbedPage, TableView, TimePicker, TitleView, ToolbarItem, Triggers, ViewBaseTests, VisualStateManager, Window, WebView, Material3

Each skipped platform and category is listed as a maui-pr-uitests (skipped) … status on this commit. Use /azp run maui-pr-uitests for the full suite.

Device tests — 103 categories, 3 platforms

Platforms not run: Android, iOS, MacCatalyst

Categories not run: Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CheckBox, Controls.Compatibility, Controls.ContentView, Controls.DatePicker, Controls.Dispatcher, Controls.Editor, Controls.Element, Controls.Entry, Controls.FlexLayout, Controls.FlyoutPage, Controls.Frame, Controls.Gesture, Controls.HybridWebView, Controls.Image, Controls.Label, Controls.Layout, Controls.Lifecycle, Controls.Map, Controls.Mapper, Controls.Memory, Controls.MenuFlyout, Controls.Modal, Controls.NavigationPage, Controls.Page, Controls.PageTransitions, Controls.Path, Controls.Picker, Controls.RadioButton, Controls.RefreshView, Controls.ScrollView, Controls.SearchBar, Controls.Shape, Controls.Shell, Controls.Slider, Controls.SwipeView, Controls.Switch, Controls.TabbedPage, Controls.TemplatedView, Controls.TextInput, Controls.Toolbar, Controls.View, Controls.VisualElement, Controls.VisualElementTree, Controls.WebView, Controls.Window, Controls.WindowOverlay, Controls.Xaml, Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, Core.Element, Core.Entry, Core.FlowDirection, Core.FlyoutView, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.NavigationPage, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.RefreshView, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.Window, Core.WindowOverlay, Graphics, Essentials, BlazorWebView

Each skipped platform and project is listed as a maui-pr-devicetests (skipped) … status on this commit. Use /azp run maui-pr-devicetests for the full suite.

🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)

UI tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android — —
iOS — —
MacCatalyst — —
Windows CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, CarouselView CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, CarouselView

GPT-6.2 Sol — Run Windows CollectionView and CarouselView UI tests for the items-handler cleanup change.

  • CollectionView covers Windows item-content release and header/footer preservation.
  • CarouselView covers the shared Items handler cleanup.
  • No other platforms or control categories are affected.

MAI Code 2 — Windows CV1 ItemsView handler fix; run CollectionView and CarouselView UI tests on Windows.

  • ItemsViewHandler.Windows.cs changes Windows CV1 item-container cleanup and is covered by the CollectionView UI suites.
  • ItemContentControl.cs releases native item content during Windows handler disconnection, exercising the shared Items handler path used by CollectionView and CarouselView.
  • No Android, iOS, or MacCatalyst platforms are needed because all production and test changes are Windows-specific.

Device tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android — —
iOS — —
MacCatalyst — —
Windows Controls.CollectionView, Controls.CarouselView Controls.CollectionView, Controls.CarouselView

GPT-6.2 Sol — Run Windows Controls device tests for CollectionView regressions and shared CarouselView cleanup.

  • Controls.CollectionView includes the new shadow-wrapper release and header/footer retention tests.
  • Controls.CarouselView covers the shared Windows Items handler.
  • No Core handler or other platform changed.

MAI Code 2 — Windows CV1 device fix; run Controls CollectionView and CarouselView device tests on Windows.

  • The new Windows CollectionView device tests validate old item content release and header/footer handler preservation.
  • The Items handler cleanup affects CollectionView and the closely coupled CarouselView control path.
  • Restrict execution to Windows; no other platforms or broad Core/device projects are touched.

Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.

@github-actions github-actions Bot added s/autopilot-waiting-for-maintainer-review MAUI Autopilot finished: expert review clean and tests passed; waiting for maintainer review and removed s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

MAUI Autopilot — Ready for maintainer review

Results
Expert review No more findings on f5c3966
Tests ⚠️ Could not run; re-run /review run-tests when CI is available
Review threads 1 resolved

This branch was previously deployed

1 inactive (outdated) deployment
copilot-pat-pool — b45dd23f Deployed Nov 26, 2026 by praveenkumarkarunanithi via conclusion #3352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

collectionview-cv1 community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows s/autopilot-waiting-for-maintainer-review MAUI Autopilot finished: expert review clean and tests passed; waiting for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] ObservableCollection reassignation can crash the MAUI engine with Shadows effects in CollectionView items.

3 participants