Repository navigation
Fix queued animation cancellation aborting replacement animations - #40696
Conversation
… UI thread aborts the next animation of the same kind on that view
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — No more findings
Reviewed commit 9cabb37.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Selected Tests
🧪 Test selection — click to expand
🧪 UI tests —
|
| Platform | Categories |
|---|---|
| Android | Animation |
| iOS | Animation |
| MacCatalyst | Animation |
| Windows | Animation |
📊 Results — succeeded: 6 passed, 0 failed of 6 jobs
🔗 All test results · Build logs
| Job | Result |
|---|---|
| Android UITests CoreClr Controls (API 30) Animation | ✅ succeeded |
| Build UITests CoreCLR Sample App Build Sample App | ✅ succeeded |
| Build UITests Windows Sample App Build Sample App (Windows) | ✅ succeeded |
| iOS UITests CoreCLR Controls (vlatest) Animation | ✅ succeeded |
| MacCatalyst UITests CoreCLR Controls Animation | ✅ succeeded |
| WinUI UITests Controls Animation | ✅ succeeded |
🧪 Device tests — Controls.Animations on Android, iOS, MacCatalyst, Windows
❌ maui-pr-devicetests #1702570 failed — 2 tests failed on Windows. See Failed tests below.
GPT-6.2 Sol: Select Controls.Animations on all four platforms because the cancellation fix is in shared Controls code.
MAI Code 2: Shared Controls animation extension fix; runs Controls.Animations device tests on all platforms.
🧪 Ran — 1 category on Android, iOS, MacCatalyst, Windows
| Platform | Categories |
|---|---|
| Android | Controls.Animations |
| iOS | Controls.Animations |
| MacCatalyst | Controls.Animations |
| Windows | Controls.Animations |
📊 Results — failed: 5 passed, 1 failed of 6 jobs
❌ Failed tests (2)
| Test | Failed on | Error |
|---|---|---|
WorkItemExecution.Controls.DeviceTests-packaged Work Item |
Windows | The Helix Work Item failed. Often this is due to a test crash. Please see the 'Artifacts' tab above for additional logs. |
WorkItemExecution.Controls.DeviceTests-unpackaged Work Item |
Windows | The Helix Work Item failed. Often this is due to a test crash. Please see the 'Artifacts' tab above for additional logs. |
🔗 All test results · Build logs
⏭️ Skipped — what neither suite runs
UI tests — 76 categories, 0 platforms
Categories not run: Accessibility, ActionSheet, ActivityIndicator, AppLinks, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, 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 — 104 categories, 0 platforms
Categories not run: Controls.Accessibility, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CarouselView, Controls.CheckBox, Controls.CollectionView, 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 | Animation |
Animation |
| iOS | Animation |
Animation |
| MacCatalyst | Animation |
Animation |
| Windows | Animation |
Animation |
GPT-6.2 Sol — Run Animation UI tests on all four platforms for the shared fix to queued cancellation of replacement animations.
- ViewExtensions.cs changes shared animation cancellation, so run Animation wherever enabled.
- AnimationTests.cs adds unit-only fade and translation regressions; no base type, layout, or platform rendering changes warrant broader UI coverage.
MAI Code 2 — Shared animation cancellation fix; runs Animation UI tests on all platforms.
ViewExtensions.cschanges shared fade and translate cancellation behavior, so all platforms can be affected.- The UI
Animationcategory directly covers animation APIs and cancellation behavior. - The accompanying file is a unit test only and adds no UI-test category.
- No full run: the change is scoped to animation extensions, not base layout, handlers, startup, or shared UI test infrastructure.
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 | Controls.Animations |
Controls.Animations |
| iOS | Controls.Animations |
Controls.Animations |
| MacCatalyst | Controls.Animations |
Controls.Animations |
| Windows | Controls.Animations |
Controls.Animations |
GPT-6.2 Sol — Select Controls.Animations on all four platforms because the cancellation fix is in shared Controls code.
- ViewExtensions.cs changes cancellation in Controls animation APIs on all four platforms.
- AnimationTests.cs is unit-only; the Core animation engine, dispatcher implementations, and handlers did not change, so omit Core and unrelated units.
MAI Code 2 — Shared Controls animation extension fix; runs Controls.Animations device tests on all platforms.
- The production change is in shared Controls
ViewExtensionsanimation cancellation logic, requiring all supported platforms. Controls.Animationsis the device-test unit for this feature area.- The changed
Core.UnitTestsfile needs unit-test validation but does not require another device-test unit. - No full suite: the patch does not alter a base element, mapper, layout pipeline, app startup, or shared device-test infrastructure.
Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.
There was a problem hiding this comment.
Expert Review — No more findings
Reviewed commit 9cabb37.
5e65173
into
dotnet:candidate/11.0.1xx-sr3
…0755) <!-- 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 Fix the deterministic `PageTransitionsTests` failures on `main`, including the product defects exposed once the More controller actually runs the transition. #### Product fixes - **Programmatically selected overflow tabs never installed the More navigation delegate.** UIKit reports the selected section's own controller, not `MoreNavigationController`, even though it displays that section inside More. Both Shell implementations now install their existing delegate for overflow sections when there are more than five tabs. This enables the custom animator, completion tracking, and shared-element flights. - **The compatibility renderer popped the wrong native stack.** Its pop-to-root operation now targets the overflow section's root on the active More controller and completes through the same transition-aware path as a single pop. It also reads the active controller's top page when recording an unanimated push, so a later pop reverses `None` instead of the page's configured Fade. - **The managed transition-coordinator binding rejects a null animation callback.** Supply a no-op animation callback while registering completion. Once the missing More delegate was fixed, the original callback produced `ArgumentNullException: animate` from `UIViewControllerTransitionCoordinatorWrapper.AnimateAlongsideTransition`. Native/default More navigation still completes immediately; only custom page transitions wait for their animation. #### Corrections to provably invalid test setup - `WindowHandlerStub` presents a workspace inside the runner's window; it never replaces `UIWindow.RootViewController`. Root-replacement tests now use a separate real window with the production content mapper. Their snapshot probe checks UIKit's native replicant class instead of the CLR `UIView` wrapper name. - `Window.PropertyChanged` runs **before** native content mapping. Install the root's own animation after the assignment, assert that it exists, and finish the replacement without detaching the root. Detaching an outgoing root lets UIKit remove its animations independently of MAUI's cleanup, invalidating the original assertion. - The destination may not have a handler immediately after `PushAsync` starts. Wait for its content to load before reading native visibility, and use a short asynchronous delay when polling so the platform animation loop can run. The original Android test throws in `NativeShown` before it can inspect a flight. - More navigation intentionally completes immediately for an unanimated push. Wait for the pushed content to load before issuing the next push/pop-to-root; otherwise UIKit has not yet finished presenting that controller. #### Which landing introduced this? The faulty transition code and tests came from #40537 (`f7d3fc1c99`), not the storyboard landing #40536 (`c1f549fd52`). Comparing those commits for all six files changed here produces an **empty diff**. The tests do not use storyboard animation holds. #40537's recorded checks include `maui-pr` but no `maui-pr-devicetests` check, so its successful build was not evidence that these device tests passed. The supplied main-branch CI window was last green at [1699752](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1699752) (`eeda7f80ed`), with the failures present from [1699985](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1699985) (`c1f549fd52`) onward, including [1703407](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703407). Before implementation, searched open and recently merged PRs across all bases, including `release/*`, `inflight/*`, and `candidate/*`. Inspected #40658 (bottom-sheet/modal transitions), #40344 (tab reselection), #40656 (TabbedPage lifecycle), #40696 (queued animation cancellation), and #40710 (zero-length tweens); none contains these fixes. #### Local causal validation All counts below are **passed / failed**, read from fresh XHarness XML with exact-class isolation verified. Each platform was measured on original sources, with the correction, with the correction reverted, and with it restored. No physical devices were used. | Phase | iOS 27 simulator | Mac Catalyst | Android API 33 emulator | | --- | --- | --- | --- | | Original baseline | 18 / 6 | 18 / 6 | 12 / 1 | | Fixed | 24 / 0 | 24 / 0 | 13 / 0 | | Reverted | 18 / 6 | 18 / 6 | 12 / 1 | | Restored | 24 / 0 | 24 / 0 | 13 / 0 | The reverted Apple failures are the two root tests and both variants of the More navigation/shared-element tests. Android reproduces the destination-handler `NullReferenceException`. The Helix Mac Catalyst opacity timeout did **not** reproduce locally; that case passed locally before and after the correction. Final validation additionally passed **24 / 0 on an iOS 18.5 simulator**. Commands below were run from an isolated worktree based on `main` at `6d74c1c0d9`. `.dotnet` contains the SDK pinned by `global.json` (`12.0.100-alpha.1.26523.103`); Xcode is 27.2. ```bash export PATH="$PWD/.dotnet:$PATH" export DOTNET_ROOT="$PWD/.dotnet" export TMPDIR="$PWD/artifacts/transition-evidence/scratch" export DOTNET_CLI_USE_MSBUILD_SERVER=0 export MSBUILDDISABLENODEREUSE=1 export DOTNET_ROLL_FORWARD=Major export HEADLESS=true ``` Preparation — all succeeded: ```bash dotnet build src/DotNet/DotNet.csproj -p:InstallDotNet=false -p:TreatWarningsAsErrors=false -v:minimal dotnet workload install ios maccatalyst --skip-manifest-update --verbosity minimal dotnet build Microsoft.Maui.BuildTasks.slnf -p:TreatWarningsAsErrors=false --disable-build-servers -v:minimal dotnet tool restore ``` iOS causal runs — original/reverted failed **18/6**; fixed/restored passed **24/0**: ```bash pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -iOSVersion 27 -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00 -Rebuild ``` Mac Catalyst causal runs — original/reverted failed **18/6**; fixed/restored passed **24/0**: ```bash pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform maccatalyst -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00 -Rebuild ``` Android causal runs — original/reverted failed **12/1**; fixed/restored passed **13/0**: ```bash export EmbedAssembliesIntoApk=true pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform android -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -Timeout 00:10:00 -Rebuild ``` The runner selected `emulator-5556` and passed `--instrumentation com.microsoft.maui.controls.devicetests.TestInstrumentation`. A separate read-only API 33 emulator was used after another emulator's unauthorized ADB transport prevented the initial attempt from running tests. iOS 18.5 final compatibility check — passed **24/0**: ```bash pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -iOSVersion 18.5 -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00 ``` Formatting/checks — passed, with workspace-loading warnings from the formatter: ```bash dotnet format whitespace Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.cs src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.iOS.cs --verify-no-changes git diff --check ``` The full repository formatter was also attempted; it emitted unrelated analyzer edits and multi-target conflict markers. Those edits were discarded, and the surgical patch was rebuilt and retested. No unrun CI check is represented as passing. ### 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. --> Deterministic main-branch `maui-pr-devicetests` failures described above; tracked here by the linked failing builds rather than an unrelated issue number. ### Let AI finish this PR - [ ] **Let the MAUI agent address review feedback and fix remaining issues on this PR.** Maintainers still decide whether it is merged. For PRs from forks, the agent opens a follow-up PR that keeps your commits. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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>
…[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>
Target Branch
mainnet11, for reviewFor .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
This pull request improves the animation cancellation logic in
ViewExtensionsto prevent queued cancellations from aborting replacement animations that reuse the same name. It introduces a helper method to check if the animation being canceled is still running before aborting, and adds comprehensive unit tests to verify correct behavior when animations are canceled and replaced.Animation Cancellation Logic Improvements
AbortIfStillRunninghelper method to ensure that only the intended animation is aborted, preventing queued cancellations from affecting replacement animations with the same name (ViewExtensions.cs). [1] [2] [3] [4]Unit Test Enhancements
AnimationTests.csto verify that canceling an old animation does not cancel a replacement, and that queued cancellations still cancel the correct animation. The tests cover various scenarios, including cancellation on different threads and with/without replacement tokens.Issues Fixed
Fixes #40688
Tested the behavior in the following platforms