Skip to content

Migrate tests from Helix and XHarness to native dotnet test - #40661

Merged
kubaflo merged 161 commits into
mainfrom
kubaflo-migrate-tests-to-dotnet-test
Nov 28, 2026
Merged

kubaflo merged 161 commits into
mainfrom
kubaflo-migrate-tests-to-dotnet-test

Conversation

@kubaflo

@kubaflo kubaflo commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Target Branch

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

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

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 [iOS, MacCatalyst] Fix Shell flyout header layout when bound text changes #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 (I get IL2111 after adding the NotFoundPage to my Router in Blazor Hybrid with full linker 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 (Re-enable platform compatibility analysis and fix findings #40663): carried the fixes from Fix platform-compatibility build breaks on main (Foldable, Maps, WebAuthenticator) #40708 (merged) and [Windows] Fix CA1416 build breaks for UISettings.AnimationsEnabledChanged (requires 10.0.19041) #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:

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:

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.

mattleibow and others added 30 commits November 5, 2026 13:52
Migrate xUnit suites and native device hosts to xUnit v3 and Microsoft.Testing.Platform, retain NUnit Appium integration, and run tests directly in CI with real TRX reporting.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve the complete default platform matrix while allowing focused secondary-pipeline validation. Add the technical terms introduced by the migration documentation to the spelling dictionary.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an explicit native Windows validation mode without review automation or automatic triggers. Keep the recursive trusted-asset workflow regression aligned with the new launcher sources.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Parse entry text with the culture used to format it. Keep the existing decimal-value assertions intact and verify both French and English runner cultures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore the Copilot pipeline unchanged and use the dedicated device-tests pipeline for migration validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Do not label the existing Windows Server image as Windows 11 or reject it with an implicit client-only guard. Preserve interactive desktop and x64 checks, both packaging modes, and an explicit Windows 11 client requirement for client pools. Document the client-specific coverage difference.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fix the nonexistent image demands reported by the remote provider. Preserve both runtimes by default while exposing the existing runtime matrix for focused runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Document macOS 15/26 and Windows 11 client coverage gaps explicitly while retaining strict OS checks and configurable execution pools.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve the selected RID on Windows project references and scope package generation to native test applications instead of their library dependencies.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reset handler factories, avoid shared Entry and theme state, and observe binding failures on the test task instead of throwing from asynchronous diagnostic callbacks. Exclude stale generated Debug sources from Release compilation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Avoid truthy string False values enabling Windows jobs or choosing CoreCLR for Mono lanes in legacy mapping-form templates.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep binding diagnostics scoped to the exact binding and assert every reported diagnostic, preserving the original expected message.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the standard xUnit executor on the real app dispatcher and verify actual fact/theory UI execution. Import the Desktop-only Appx module through Windows PowerShell compatibility when installing and cleaning owned packages from pwsh.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assert both invocation and disposal errors on all platforms without leaving the app's root service provider faulted.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Avoid empty emulator console responses on macOS while preserving exact AVD identity checks and owned cleanup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Release APK assembly stores and ReadyToRun both leave Assembly.Location empty. Use supported SDK fast deployment and IL loading while retaining Release optimization; document the loading-coverage difference.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reproduce a pre-existing native UI thread without inherited AsyncLocal state, then flow the caller's execution context without replacing the UI synchronization context.

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the retired Helix entrypoint deleted while migrating main's new visual-comparer project into the xUnit v3/MTP inventory.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
xUnit v3 now awaits fixture disposal; keep animation-manager teardown on the Android Looper instead of disposing its platform ticker on an MTP worker. Preserve the existing leak assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Exercise AnimationManager startup with an explicitly enabled platform ticker without changing system accessibility settings. Retain synchronous MTP logs when a native test exits before finalizing TRX.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore AppActions' launcher prerequisite and unregister test lifecycle listeners before their Java callbacks can be collected. Preserve all regression assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use xUnit v3 4.0.2 and coherent MTP 2.5.1 modules for existing theory display-name filters. Preserve sequential execution, timeouts and cancellation; align NUnit's bridge and attachment paths; keep native attributes out of the Appium host. Use OS-native child probes without changing shared build environment.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Collect fresh DiagnosticReports entries containing the job-owned simulator UUID, preserving evidence when the native app aborts before producing TRX.

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

This comment has been minimized.

@kubaflo

kubaflo commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@dalexsoto stamp

@azure-pipelines

This comment has been minimized.

@kubaflo

kubaflo commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Windows device-test infrastructure: status

Windows device tests now run end to end under native dotnet test, both packaged (signed MSIX) and unpackaged. The infrastructure fixes:

  • Signed MSIX install (0x800B0109): Windows' package installer only accepts certificates trusted machine-wide, so the test signer's public certificate now goes into LocalMachine\TrustedPeople, as the Helix setup did. The private key stays non-exportable in CurrentUser\My, and cleanup removes the certificate again.
  • Packaged launch: the WinApp build tools replaced the run command with winapp run, which tried to register a development-mode copy alongside the installed MSIX. EnableWinAppRunSupport=false for packaged device tests, so the installed-package launcher starts the app.
  • Controls test-host crashes (0xDEAD): this exit code only means the testing platform's test host crashed (see dotnet test fails with MissingTestSessionEnd and exit code 57005 (0xDEAD) sdk#53958). Like the former cake/Helix runner, each Controls category now runs in its own test host: one build, then --no-build runs per category, one TRX per category, and a failing category doesn't stop the rest.
  • ShellView.Disconnect threw from Window.Closed once the Shell item handler was already disconnected, which killed the process.
  • Diagnostics: Windows Error Reporting local dumps are now registered for the test executables and removed after the run. Application error events are collected for each category's test-host process.

Results: on net11 (#40703), BlazorWebView, Core, Essentials and Graphics pass both packaged and unpackaged. On main (this PR), Essentials and Graphics pass both ways, and 45 of 56 Controls categories pass, including CollectionView, where the single-process run used to crash.

Remaining test failures are not related to this PR

These are failures of individual tests, not of the test infrastructure:

@kubaflo
kubaflo marked this pull request as ready for review November 27, 2026 22:23
Copilot AI balanced review requested due to automatic review settings November 27, 2026 22:23

Copilot AI 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.

🔵 Needs a closer look

The runner migration and Windows teardown changes require owner review because MSIX signer-trust failures and unpackaged Controls termination leave representative Windows runtime validation unresolved.

No open issues 🎉

What changed in this PR

Continues #39918 by moving .NET MAUI’s test infrastructure to native dotnet test on Microsoft.Testing.Platform for the .NET 12 line. The changes align test projects, shared runners, and local tooling while addressing lifecycle and test-isolation issues exposed by the migration.

Changes:

  • Migrate xUnit projects and helpers to xUnit v3, enable Microsoft.Testing.Platform, and update coverage dependencies.
  • Remove legacy visual-runner and Helix/XHarness components; configure native test startup and TRX reporting.
  • Adapt tests for cancellation, UI-thread execution, and reliable cleanup, with related Windows lifecycle and platform-compatibility fixes.
File Description
src/​TestUtils/​tests/​VisualTestUtils.MagickNet.Tests/​VisualTestUtils.MagickNet.Tests.csproj Enables executable xUnit v3/MTP tests.
src/​TestUtils/​tests/​TestUtils.UnitTests/​Program.cs Exercises the headless controller entry point.
src/​TestUtils/​src/​UITest.NUnit/​UITest.NUnit.csproj Updates NUnit and removes the legacy adapter.
src/​TestUtils/​src/​TestUtils/​TestUtils.csproj Uses xUnit v3 helper packages.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Utilities/​ToolRunner.cs Updates the xUnit output-helper namespace.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Utilities/​TestEnvironment.cs Updates simulator documentation terminology.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Utilities/​DotnetInternal.cs Updates the xUnit output-helper namespace.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Utilities/​BuildWarningsUtilities.cs Updates the xUnit output-helper namespace.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Usings.cs Removes the obsolete xUnit namespace.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​TestResources/​TemplateLaunchInstrumentation.cs Emits a successful-launch completion marker.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Microsoft.Maui.IntegrationTests.csproj Enables executable xUnit v3/MTP integration tests.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​BuildWarningsUtilitiesTests.cs Implements the updated output-helper contract.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Android/​Emulator.cs Updates the xUnit output-helper namespace.
src/​TestUtils/​src/​Microsoft.Maui.IntegrationTests/​Android/​Adb.cs Exposes the adb path and updates xUnit imports.
src/​TestUtils/​src/​DeviceTests/​TestUtils.DeviceTests.csproj Replaces legacy runner dependencies with xUnit v3.
src/​TestUtils/​src/​DeviceTests/​RepeatAttribute.cs Adapts repeated theory data to xUnit v3.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​XamlExtensions/​EmbeddedResourceExtension.cs Removes visual-runner resource loading.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​XamlExtensions/​EmbeddedHtmlExtension.cs Removes visual-runner HTML loading.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​ViewModels/​ViewModelBase.cs Removes the visual-runner view-model base.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​ViewModels/​TestState.cs Removes visual-runner test states.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​ViewModels/​RunStatus.cs Removes visual-runner status values.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Sinks/​DiagnosticMessageSink.cs Removes the legacy diagnostic sink.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Pages/​TestResultPage.xaml.cs Removes result-page behavior.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Pages/​TestAssemblyPage.xaml.cs Removes assembly-browser behavior.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Pages/​CreditsPage.xaml.cs Removes credits-page behavior.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Pages/​CreditsPage.xaml Removes the credits-page layout.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Navigation/​PageType.cs Removes visual-runner page identifiers.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Navigation/​Navigator.cs Removes visual-runner navigation.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​Navigation/​INavigation.cs Removes the visual navigation contract.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​MauiVisualRunnerApp.xaml Removes visual-runner application resources.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​ITestRunner.cs Removes the visual execution contract.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​ITestListener.cs Removes the visual results-listener contract.
src/​TestUtils/​src/​DeviceTests.Runners/​VisualRunner/​AssemblyRunInfo.cs Removes legacy assembly-run metadata.
src/​TestUtils/​src/​DeviceTests.Runners/​TestWindow.cs Removes legacy iOS window lookup.
src/​TestUtils/​src/​DeviceTests.Runners/​TestServices.cs Resolves Apple services through the platform application.
src/​TestUtils/​src/​DeviceTests.Runners/​TestRunnerInfo.plist Configures the native test scene delegate.
src/​TestUtils/​src/​DeviceTests.Runners/​TestOptions.cs Selects one executable test assembly.
src/​TestUtils/​src/​DeviceTests.Runners/​TestAssemblyInfo.cs Disables parallelism and selects the Windows test framework.
src/​TestUtils/​src/​DeviceTests.Runners/​HeadlessRunnerOptions.cs Defaults results to a TRX filename.
src/​TestUtils/​src/​DeviceTests.Runners/​HeadlessRunner/​Windows/​TestLogger.cs Removes the legacy Windows logger.
src/​TestUtils/​src/​DeviceTests.Runners/​HeadlessRunner/​TestDevice.cs Removes the XHarness device adapter.
src/​TestUtils/​src/​DeviceTests.Runners/​HeadlessRunner/​iOS/​MauiTestViewController.cs Removes legacy view-controller-driven execution.
src/​TestUtils/​src/​DeviceTests.Runners/​Assets/​credits.html Removes the retired visual runner’s credits asset.
src/​TestUtils/​samples/​DeviceTests.Sample/​UnitTests.cs Removes the obsolete xUnit namespace.
src/​TestUtils/​samples/​DeviceTests.Sample/​TestUtils.DeviceTests.Sample.csproj Imports native test-runner properties.
src/​TestUtils/​samples/​DeviceTests.Sample/​Startup.cs Configures a single assembly and headless execution.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​SkiaSharpSvgToolsTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​SkiaSharpRasterToolsTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​SkiaSharpAppIconToolsTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​ResizetizeImagesTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​ResizetizeImagesIncrementalTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​PathCanonicalizerTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​MSBuildTaskFixture.cs Updates the xUnit output-helper namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​MauiResizetizerTargetsTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​GetMauiAssetsPathTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​GenerateSplashStoryboardTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​GenerateSplashAssetsTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​GenerateSplashAssetCatalogTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​GenerateSplashAndroidResourcesTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​GeneratePackageAppxManifestTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​DetectStaleOutputFilesTaskTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​DetectInvalidResourceOutputFilenamesTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​DeleteStaleOutputFilesTaskTests.cs Removes the obsolete xUnit namespace.
src/​SingleProject/​Resizetizer/​test/​UnitTests/​BaseTest.cs Removes the obsolete xUnit namespace.
src/​Graphics/​tests/​Graphics.Tests/​Graphics.Tests.csproj Enables xUnit v3/MTP and replaces coverage tooling.
src/​Graphics/​tests/​DeviceTests/​Startup.cs Configures single-assembly headless execution.
src/​Essentials/​test/​UnitTests/​TextToSpeech_Tests.cs Passes test cancellation tokens.
src/​Essentials/​test/​UnitTests/​Essentials.UnitTests.csproj Enables executable xUnit v3/MTP tests.
src/​Essentials/​test/​UnitTests/​Contacts_Tests.cs Passes the test cancellation token.
src/​Essentials/​test/​ExternalBackendTests/​ExternalTextToSpeechBackendTests.cs Passes the test cancellation token.
src/​Essentials/​test/​ExternalBackendTests/​Essentials.ExternalBackend.UnitTests.csproj Enables executable xUnit v3/MTP tests.
src/​Essentials/​test/​DeviceTests/​Tests/​WindowStateManager_Tests.cs Runs UIKit queries on the main thread.
src/​Essentials/​test/​DeviceTests/​Tests/​VersionTracking_Tests.cs Updates the xUnit namespace import.
src/​Essentials/​test/​DeviceTests/​Tests/​SecureStorage_Tests.cs Updates the xUnit namespace import.
src/​Essentials/​test/​DeviceTests/​Tests/​HapticFeedback_Tests.cs Runs haptic operations on the main thread.
src/​Essentials/​test/​DeviceTests/​Tests/​AppActions_Tests.cs Starts app-action testing on the main thread.
src/​Essentials/​test/​DeviceTests/​Startup.cs Configures single-assembly headless execution.
src/​Essentials/​src/​WebAuthenticator/​WebAuthenticator.windows.cs Guards access to the newer Windows AppInfo API.
src/​Essentials/​src/​Platform/​WindowMessageManager.windows.cs Preserves the original window procedure during callbacks.
src/​Core/​tests/​UnitTests/​Core.UnitTests.csproj Enables xUnit v3/MTP and updates coverage tooling.
src/​Core/​tests/​UnitTests/​AbstractViewHandlerTests.cs Resets shared handler-factory state.
src/​Core/​tests/​DeviceTests/​Services/​FontManagerTests.iOS.cs Measures native text on the main thread.
src/​Core/​tests/​DeviceTests/​MauiProgram.cs Selects the executable test assembly.
src/​Core/​tests/​DeviceTests/​Handlers/​SwipeView/​SwipeItemMenuItemHandlerTests.Android.cs Enables nullable annotations.
src/​Core/​tests/​DeviceTests/​Handlers/​ScrollView/​ScrollViewHandlerTests.Android.cs Enables nullable annotations.
src/​Core/​tests/​DeviceTests/​Handlers/​Image/​ImageHandlerTests.Android.cs Tests cleanup with an already-disposed native peer.
src/​Core/​tests/​DeviceTests/​Animations/​PlatformTickerTests.Windows.cs Forces animation availability and disposes test resources.
src/​Core/​tests/​DeviceTests.Shared/​Core.DeviceTests.Shared.csproj Replaces XHarness dependencies with xUnit v3 helpers.
src/​Core/​src/​WindowOverlay/​WindowOverlay.Windows.cs Clears native overlay references during teardown.
src/​Core/​src/​Handlers/​ScrollView/​ScrollViewHandler.Windows.cs Defers tab-stop restoration for attached loading views.
src/​Core/​src/​Handlers/​HybridWebView/​HybridWebViewHandler.Windows.cs Handles disconnect when CoreWebView2 is unavailable.
src/​Core/​src/​Animations/​PlatformTicker.Windows.cs Guards animation-setting event subscriptions by OS version.
src/​Controls/​tests/​Xaml.UnitTests/​MSBuild/​_Directory.Build.props Replaces Helix paths with repository-root discovery.
src/​Controls/​tests/​Xaml.UnitTests/​Issues/​Maui24849.xaml.cs Uses shared fixture cleanup.
src/​Controls/​tests/​Xaml.UnitTests/​Issues/​Maui13619.xaml.cs Uses shared cleanup and explicit application theme state.
src/​Controls/​tests/​Xaml.UnitTests/​Issues/​Issue2659.xaml.cs Isolates application state through the shared fixture.
src/​Controls/​tests/​TestCases.Shared.Tests/​UITest.cs Uses the executable base directory for visual tests.
src/​Controls/​tests/​TestCases.HostApp/​Directory.Build.targets Imports native runner targets only when enabled.
src/​Controls/​tests/​SourceGen.UnitTests/​XamlIncrementalHotReloadE2ETests.cs Makes diagnostic collection cancellable.
src/​Controls/​tests/​SourceGen.UnitTests/​NamingHelpersTests.cs Makes syntax parsing cancellable.
src/​Controls/​tests/​SourceGen.UnitTests/​MetadataUpdateFactAttributeTests.cs Supplies xUnit v3 fact source information.
src/​Controls/​tests/​SourceGen.UnitTests/​Maui13856Tests.cs Makes syntax parsing cancellable.
src/​Controls/​tests/​SourceGen.UnitTests/​InitializeComponent/​SetterValueInTrigger.cs Makes syntax parsing cancellable.
src/​Controls/​tests/​SourceGen.UnitTests/​InitializeComponent/​Maui40145Tests.cs Makes parsing and assembly emission cancellable.
src/​Controls/​tests/​SourceGen.UnitTests/​InitializeComponent/​LazyStyleHotReload.cs Makes syntax parsing cancellable.
src/​Controls/​tests/​SourceGen.UnitTests/​HotReload/​Maui39763Tests.cs Adds cancellation to parsing and diagnostics.
src/​Controls/​tests/​DeviceTests/​MauiProgram.cs Selects the executable test assembly.
src/​Controls/​tests/​DeviceTests/​Elements/​Window/​WindowTests.cs Runs window activation testing on the main thread.
src/​Controls/​tests/​DeviceTests/​Elements/​Window/​WindowOverlayTests.cs Verifies Windows drawable cleanup.
src/​Controls/​tests/​DeviceTests/​Elements/​VisualElementTree/​FindVisualTreeElementInsideTestCase.cs Updates xUnit serialization imports.
src/​Controls/​tests/​DeviceTests/​Elements/​Modal/​ModalTests.cs Uses an owned window and awaits destruction.
src/​Controls/​tests/​DeviceTests/​Elements/​Map/​MapTests.iOS.cs Runs native annotation testing on the main thread.
src/​Controls/​tests/​DeviceTests/​Elements/​Map/​MapTests.cs Runs map teardown testing on the main thread.
src/​Controls/​tests/​DeviceTests/​Elements/​CollectionView/​CollectionViewTests.iOS.cs Documents intentional legacy-handler coverage.
src/​Controls/​tests/​DeviceTests/​Elements/​CollectionView/​CollectionViewTests.cs Updates the xUnit namespace import.
src/​Controls/​tests/​DeviceTests/​Elements/​CollectionView/​CollectionViewSizingTestCase.cs Updates xUnit serialization imports.
src/​Controls/​tests/​DeviceTests/​Elements/​CarouselView/​CarouselViewTests.cs Returns Task instead of async void.
src/​Controls/​tests/​Core.UnitTests/​ViewUnitTests.cs Prevents inline timer-test continuations.
src/​Controls/​tests/​Core.UnitTests/​StyleSheets/​StyleTests.cs Preserves the effective CSS feature setting.
src/​Controls/​tests/​Core.UnitTests/​StateTriggerTests.cs Makes the test Entry instance-local.
src/​Controls/​tests/​Core.UnitTests/​ShellLifeCycleTests.cs Prevents inline lifecycle-test continuations.
src/​Controls/​tests/​Core.UnitTests/​NavigationUnitTest.cs Awaits initial navigation before testing removal.
src/​Controls/​tests/​Core.UnitTests/​MockDeviceDisplay.cs Exposes subscriber counts for tests.
src/​Controls/​tests/​Core.UnitTests/​MenuItemTests.cs Returns Task instead of async void.
src/​Controls/​tests/​Core.UnitTests/​MapTests.cs Scopes platform-warning suppression to property-only tests.
src/​Controls/​tests/​Core.UnitTests/​ListProxyTests.cs Clears thread-static dispatcher options after use.
src/​Controls/​tests/​Core.UnitTests/​Controls.Core.UnitTests.csproj Enables xUnit v3/MTP and updates coverage tooling.
src/​Controls/​tests/​Core.UnitTests/​BindingUnitTests.cs Sets invariant culture for numeric binding assertions.
src/​Controls/​tests/​Core.UnitTests/​BaseTestFixture.cs Disables parallelism and resets dispatcher options.
src/​Controls/​tests/​Core.Design.UnitTests/​Controls.Core.Design.UnitTests.csproj Enables executable xUnit v3/MTP design tests.
src/​Controls/​tests/​BindingSourceGen.UnitTests/​IncrementalGenerationTests.cs Makes generator execution cancellable.
src/​Controls/​src/​Core/​Window/​Window.cs Disconnects Windows page handlers before scope disposal.
src/​Controls/​src/​Core/​Platform/​ModalNavigationManager/​ModalNavigationManager.Windows.cs Disconnects modal-page descendant handlers.
src/​Controls/​src/​Core/​Handlers/​Shell/​Windows/​ShellView.cs Safely accesses already-disconnected item handlers.
src/​Controls/​src/​Core/​Animations/​MotionPolicy.Windows.cs Guards animation-setting events by OS version.
src/​Controls/​Foldable/​test/​Controls.Foldable.UnitTests.csproj Enables xUnit v3/MTP and updates coverage tooling.
src/​Controls/​Foldable/​src/​iOS/​HostBuilderExtensions.cs Documents and suppresses the legacy KeyWindow warning.
src/​BlazorWebView/​tests/​MauiBlazorWebView.UnitTests/​MauiBlazorWebView.UnitTests.csproj Enables xUnit v3/MTP and updates coverage tooling.
src/​BlazorWebView/​tests/​DeviceTests/​Platforms/​iOS/​Info.plist Removes the conflicting bundle identifier override.
src/​BlazorWebView/​tests/​DeviceTests/​MauiProgram.cs Passes a single test assembly to shared startup.
src/​BlazorWebView/​tests/​DeviceTests/​Elements/​BlazorWebViewTests.cs Updates the xUnit output-helper namespace.
src/​BlazorWebView/​tests/​BlazorWebView.Windows.UnitTests/​WpfDispatcherTests.cs Makes dispatcher waits cancellable.
src/​BlazorWebView/​tests/​BlazorWebView.Windows.UnitTests/​WindowsFormsDispatcherTests.cs Makes dispatcher waits cancellable.
helix.sh Removes the Unix Helix submission wrapper.
helix.cmd Removes the Windows Helix submission wrapper.
global.json Selects MTP and removes the Helix SDK.
eng/​scripts/​update-cgmanifest.ps1 Updates test-package version mappings.
eng/​scripts/​Install-AndroidSdkPackage.ps1 Restores previously absent environment variables correctly.
eng/​pipelines/​common/​variables.yml Removes the Helix credential variable group.
eng/​pipelines/​common/​ui-tests-steps.yml Updates the device-selector comment.
eng/​pipelines/​common/​ui-tests-build-sample.yml Updates the device-selector comment.
eng/​pipelines/​ci-uitests.yml Includes shared script changes in pipeline triggers.
eng/​pipelines/​arcade/​variables.yml Removes Helix wrapper variables.
eng/​pipelines/​arcade/​setup-test-env.yml Shuts down stale build servers after workload installation.
eng/​NuGetVersions.targets Centralizes MTP and coverage package versions.
eng/​devices/​catalyst.cake Replaces XHarness execution with the native test helper.
eng/​automation/​cspell/​cSpell.json Adds migration-related vocabulary.
Directory.Build.props Disables legacy Arcade test SDK and xUnit tooling.
.github/​skills/​verify-tests-fail-without-fix/​SKILL.md Documents target-specific MTP/VSTest protocol selection.
.github/​skills/​run-device-tests/​scripts/​windows-launcher/​WindowsTestLauncher.csproj Defines the Windows launcher executable project.
.github/​scripts/​NotificationCenterScripts.Tests.ps1 Extends script-path coverage to nested launcher files.
.github/​README-AI.md Describes the retained instruction file’s direct-test role.
.config/​dotnet-tools.json Removes the XHarness CLI tool.

Review effort: Balanced

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

kubaflo added a commit that referenced this pull request Nov 28, 2026
…anged requires 10.0.19041) (#40751)

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

Follow-up to #40720. `main` still fails every Windows build (maui-pr,
maui-pr-uitests Windows sample apps, maui-pr-devicetests Windows) with
CA1416, now in Controls:

```
src\Controls\src\Core\Animations\MotionPolicy.Windows.cs(19,4): error CA1416: This call site is reachable on: 'Windows' 10.0.17763.0 and later. 'UISettings.AnimationsEnabledChanged' is only supported on: 'Windows' 10.0.19041.0 and later.
src\Controls\src\Core\Animations\MotionPolicy.Windows.cs(22,35): error CA1416: (same, unsubscribe)
```

Seen in maui-pr
[1703328](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703328),
maui-pr-uitests
[1703372](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703372)
and maui-pr-devicetests
[1703407](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703407)
at `bd06cae91b`. #40720 fixed the same API in Core's `PlatformTicker`;
once Core compiled, Controls (`PlatformMotionPolicy`, added in #40536)
surfaced the same error.

The fix mirrors #40720: subscribe/unsubscribe to
`UISettings.AnimationsEnabledChanged` only on Windows 10.0.19041+. On
older builds the reduced-motion value is still read from
`UISettings.AnimationsEnabled`; it just isn't updated live. This is the
only remaining `AnimationsEnabledChanged` use in `src/`.

The same hunk is also part of the large migration PR #40661 (and its
validation draft #40706); the change is identical, so it will reconcile
cleanly.

**Validation** (macOS, minimal `net11.0-windows10.0.19041.0` project
with `SupportedOSPlatformVersion=10.0.17763.0`,
`EnableWindowsTargeting=true`, CA1416 as error, compiling the exact
before/after code with `dotnet build`):
- baseline (current code): red, the same two CA1416 errors
- fix: green
- fix reverted: red
- restored: green

The full Windows build runs in this PR's CI.

### Issues Fixed

Fixes the `main` Windows build break (CA1416) left after #40720.

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

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo
kubaflo merged commit b5108cd into main Nov 28, 2026
38 of 89 checks passed
@kubaflo
kubaflo deleted the kubaflo-migrate-tests-to-dotnet-test branch November 28, 2026 11:34
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 added a commit that referenced this pull request Nov 28, 2026
…otnet test migration to net11 (#40763)

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

Repository infrastructure only; targets `net11` so its CI, agentic and
release tooling matches `main`.

### Description of Change

Brings the repository-infrastructure merges from `main` (since `net11`
diverged) to `net11`: `/review` run-tests / run-ui-tests /
run-device-tests, MAUI Autopilot, release tooling, signing validation
and related docs. Each commit is a `git cherry-pick -x` of the merged
PR; all applied without conflicts (the `eng/` part of #40545 was already
backported in #40629).

**Included (28 commits):**
- [release] Recover from squash-merged CI normalization PRs (#40566)
- [Release state] Advance 11.0.1xx to SR3 (#40571)
- [ci] /review run-tests, run-ui-tests and run-device-tests; MAI Code 2
as the second model (#40545)
- Document that forward PRs must never use long-lived branches as head
(#40582)
- [ci] /review run-tests: standard /review comment layout; fix MAI Code
2 (#40591)
- [ci] /review run-tests: don't rewrite Result badges of older comments
(#40592)
- [ci] /review run-tests: show each Azure DevOps job as a check on the
PR (#40612)
- Remove standalone /review gate workflow (#40595)
- [ci] Hide /review run-tests command comments once acknowledged
(#40593)
- [ci] /review run-tests: report jobs as commit statuses named after the
pipeline (#40624)
- Remove standalone /review tests failure-analysis lane (#40596)
- [ci] /review run-tests: build PRs only with their target branch's
pipeline (#40628)
- [ci] /review run-tests: report skipped, selection and run checks as
commit statuses (#40627)
- [ci] /review run-tests: fix the dispatch crash on existing statuses;
log refused dispatches (#40631)
- [ci] /review run-tests: let release-branch dispatches be pushed
(#40634)
- [ci] Re-enable signing validation in the official pipeline (#39524)
- Group Dependabot NuGet updates for main and net11 (#40650)
- [ci] Hide dogfood and skill validation comments (#40651)
- Add MAUI Autopilot: /review autopilot drives review → fix → tests on
opted-in PRs (#40668)
- MAUI Autopilot: three-model cross-examined fixes (adds Claude Opus
5.5), Copilot review threads, test failure evidence, clear endings
(#40672)
- [release] Merge candidate into inflight daily without rewriting
history (#40671)
- MAUI Autopilot: three-model triage of failing tests and a
needs-maintainer-decision label (#40707)
- MAUI Autopilot: install the repository .NET SDK so fix rounds can run
unit tests (#40732)
- MAUI Autopilot: a maintainer's /review autopilot always runs (#40738)
- MAUI Autopilot: every /review autopilot handles all earlier review
suggestions; stop no-op issue mentions (#40743)
- MAUI Autopilot: fix fork follow-ups (squash out-of-src commits, proper
endings) and never fail on missing test evidence (#40746)
- MAUI Autopilot: resolve merge conflicts, add UI screenshot baselines
from Azure DevOps, back off on rate limits (#40750)
- Migrate tests from Helix and XHarness to native dotnet test (#40661)
[net11] — conflicts resolved to the net11 tree CI-validated in #40703
(`net11.0` TFM, CoreCLR **and Mono** device-test runtimes, net11 Arcade
SDK); SourceGen tests for .NET 12-only features are not brought over.

**Deliberately excluded:**
- .NET 12 product features and bug fixes (animations, ContentButton,
ScrollAnchorMode, trimming, XSG styles, Label.IsTextSelectable,
Preferences enums, image metadata, QueryProperty, binding/route/XAML
fixes, …).
- #40060 Move main to .NET 12; main-only build-break fixes (#40666,
#40674, #40708, #40720, #40751) and #40663 platform-compatibility
re-enable (product code changes).
- Dependabot bumps (#40639, #40640, #40641, #40643) — `net11` gets its
own grouped Dependabot updates (#40650); localization check-ins.
- #40615 — empty commit upstream.

**Note for reviewers:** #40672 adds `maui-expert-autopilot-opus` (Claude
Opus 5.5). `CopilotPipeline.Tests.ps1` → "contains no Anthropic model
identifiers" fails on it exactly as it does on `main` today. Drop that
workflow here if `net11` should keep that policy test green.

### Validation

**CI (`/azp run` on this PR):**
| Pipeline | Result |
| --- | --- |
| `maui-pr`
[1703708](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703708)
(build, pack, unit + integration tests on `dotnet test`/MTP) | ✅
succeeded |
| `maui-pr-uitests`
[1703714](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703714)
| ✅ succeeded |
| `maui-pr-devicetests`
[1703715](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703715)
| 38/41 jobs ✅ — all Android, iOS, Mac Catalyst (CoreCLR + Mono) pass |

Device-test failures (Windows only):
- `Windows controls packaged/unpackaged`: test host terminates with
`0xDEAD` in the NavigationPage category — the known Windows blocker
listed in #40661; the same two jobs fail on `main` after #40661
([1703728](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703728))
and on #40703
([1703325](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703325)).
- `Windows blazorwebview unpackaged`: one test,
`InterceptedResponseWithoutABodyIsServedWithASingleContentTypeHeader(isContentNull:
False)`, timed out after 30 s waiting for CoreWebView2. The same lane
passed on #40703.

GitHub checks: `Validate (PR)` (Release Readiness) fails in
`MauiReleaseConfiguration.Tests.ps1` ("Wrong evaluated label on
candidate/11.0.1xx-sr1"). It is triggered here because #40566 touches
`MauiReleaseConfiguration.psm1`, and #40566 failed the same check on
`main`; it also fails locally on unmodified `net11`. Skill-validation
evals fail on unavailable `COPILOT_PAT_*` tokens and fixture fetches,
the same as on #40661/#40703.

**Local:** `actionlint` on changed workflows (exit 0); YAML and
PowerShell parse of all changed files (no errors). Pester over the
`powershell-script-tests.yml` paths: 26 failures vs 28 on unmodified
`net11`. The only new failure is the Anthropic-model policy test (see
note above), which also fails on `main`.

### Issues Fixed

N/A — repository infrastructure sync.

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

---------
kubaflo added a commit that referenced this pull request Nov 28, 2026
…40770)

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

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

### Target Branch

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

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

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

### Description of Change

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

Keep Mac Catalyst device-test fixtures from borrowing a destroyed
scene's native window after a modal-window test. **Test infrastructure
only; no product behavior changes or test exclusions.**

- `ContextStub` selects a visible window with a root controller in a
foreground scene, preferring a key window. It fails with an explicit
diagnostic if no live window exists, rather than returning a
stale/rootless key window.
- Fixture cleanup retains the native window actually used by the handler
instead of querying the application's global key window after
disconnect.
- `DisappearingEventFiresWhenWindowClosedWithModal` restores the
captured host after closing its separate window and waits for a live
foreground/key host. Four `WINDOW` messages report native host/key/root
identities and scene state for CI diagnosis.

#### CI mechanism evidence and limits

The red baseline is [`main` build
1703707](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703707),
`Catalyst controls CoreCLR macos27`: **2226 total, 1513 passed, 671
failed, 42 skipped**.

Step log 990 starts the second
`DisappearingEventFiresWhenWindowClosedWithModal` variant at
**13:18:06.794 UTC**. UIKit reports an unbalanced appearance transition
at **13:18:06.909**. The immediately following test fails in
`WindowHandlerStub.UpdateContent` at **13:18:06.951**. All **671**
failures have that fixture signature, with the last at **13:19:01.581**,
just before the run finishes.

**The supplied log does not record native key-window identities or scene
states, and does not demonstrate recovery.** Aggregate job log 1000
includes the same step timestamps; it is not independent retry evidence.
Selection of a rootless closed-scene window is the plausible mechanism,
not a causally proven observation from those logs.

Local `WINDOW` messages establish a relevant UIKit behavior: the host
can remain `IsKeyWindow=true` while `UIApplication.GetKeyWindow()`
selects the newly opened window. Key state is per scene, not unique
across all application windows. The new fixture resolver also checks
scene liveness, visibility and the root controller.

Searched open and recently merged PRs across all bases before
implementation. Inspected #40755 (transition fixtures; different files
and mechanism). Searches for `WindowHandlerStub`,
`DisappearingEventFiresWhenWindowClosedWithModal`, and Catalyst fixes
found no existing correction for this cascade.

#### Local validation

Host: **macOS 26.7.3, Xcode 27.2**, pinned SDK
**12.0.100-alpha.1.26523.103**, CoreCLR. CI uses **macOS 27 / Xcode
27.1**. The local workload requires the explicit
`ValidateXcodeVersion=false` override for the installed Xcode.

**Local red/revert reproduction of the cascade was impossible:** the
previous full baseline had **2180 passed, 4 failed, 42 skipped**, with
**zero** `WindowHandlerStub.UpdateContent` NREs. The four failures were
existing CollectionView layout assertions, not this cascade. No
red/revert success is claimed.

Commands:

```bash
export DOTNET_ROOT="$PWD/.dotnet" PATH="$PWD/.dotnet:$PATH" MSBUILDDISABLENODEREUSE=1

dotnet test --project src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj --configuration Release --framework net12.0-maccatalyst -p:RuntimeIdentifier=maccatalyst-arm64 -p:CodesignRequireProvisioningProfile=false -p:UseMonoRuntime=False -p:ValidateXcodeVersion=false -p:MauiTestFilter=Category=Modal -p:MauiTestResultsDirectory="$PWD/catalyst-validation/modal"

dotnet test --project src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj --configuration Release --framework net12.0-maccatalyst -p:RuntimeIdentifier=maccatalyst-arm64 -p:CodesignRequireProvisioningProfile=false -p:UseMonoRuntime=False -p:ValidateXcodeVersion=false -p:MauiTestFilter= -p:MauiTestResultsDirectory="$PWD/catalyst-validation/full"

dotnet format whitespace Microsoft.Maui.sln --no-restore --include src/Core/tests/DeviceTests.Shared/Stubs/ContextStub.cs src/Controls/tests/DeviceTests/ControlsHandlerTestBase.iOS.cs src/Controls/tests/DeviceTests/Elements/Modal/ModalTests.cs --verify-no-changes

git diff --check
```

- Modal: **passed, 225 passed / 0 failed / 0 skipped**, genuine TRX. All
four close-window variants restore their live host.
- Full suite: **failed, 2180 passed / 4 failed / 42 skipped**, genuine
TRX, **zero fixture NREs**. The same four
`AScrollToInTheSameUpdateAsAHorizontalListTurningVerticalWinsWhenItComesAfter`
assertions failed on the unchanged local baseline (both `scrollFirst`
values, both NavigationPage variants). No additional failures in this
completed run; the full suite is **not green**.
- Scoped formatter: **failed**, with workspace-loading warnings and 102
platform-conditional whitespace diagnostics. No unrelated formatting
changes applied.
- `git diff --check`: **passed**.

An intermediate full attempt lost its ignored artifact tree/result
stream while running and is not counted. The final fresh TRX paths above
were used after restoring missing SDK files from the same pinned SDK
archive; no tracked source changes were made for recovery.

**Causal validation still requires this PR's macOS 27 Catalyst CI job
versus red baseline 1703707.** [Device build
1703850](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703850)
was requested after stamping the PR and remains queued at the last
check. Local compatibility checks do not establish that the CI-only
cascade is fixed.

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

Addresses the Mac Catalyst fixture cascade recorded in the linked
main-branch build after #40661. No unrelated issue closure.

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

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

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

### Target Branch

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

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

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

### Description of Change

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

Fix the iOS UI-test `vlatest` lane without changing the pinned `v18.5`
lane.

In [main build
1703706](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703706),
three CoreCLR `vlatest` groups (CollectionView3, Cells/CheckBox,
Lifecycle/ManualReview/Maps) failed setup five times before executing
tests: `No installed iOS simulator runtime matches ios-simulator-64`.
Their command lines requested `--apiversion=18.5`, while those agents
only had iOS 26.x installed.

The CoreCLR matrix hard-coded `18.5` for `latest`
(`eng/pipelines/common/ui-tests.yml`, formerly line 462), and NativeAOT
similarly substituted `defaultiOSVersion`. After #40661, `GetUDID` uses
this API-version argument for an unsuffixed simulator selector, making
that substitution an actual runtime requirement rather than merely
Appium metadata.

- Pass the matrix's literal version through in both runtime variants.
The existing Cake resolver already selects the highest available
installed iOS runtime for `latest`.
- Set Appium's `PLATFORM_VERSION` from the selected simulator's actual
runtime. Do not pass the symbolic selector to Appium or misreport the
installed OS.
- Preserve pinned simulator selectors and runtime installation behavior;
do not install a runtime for the latest lane merely to satisfy an
obsolete pin.
- Document the selector semantics in the canonical CI facts.

Searched open and recently merged upstream PRs before implementing.
#40407 concerns exact runtime provisioning; it does not fix this matrix
substitution. No existing fix found.

#### Validation

- `python3` with `yaml.safe_load` on
`eng/pipelines/common/ui-tests.yml`,
`eng/pipelines/common/ui-tests-steps.yml`, and
`eng/pipelines/ci-uitests.yml`: **passed**.
- `DOTNET_ROLL_FORWARD=Major dotnet exec
/Users/kubaflo/.nuget/packages/cake.tool/7.0.0/tools/net10.0/any/Cake.dll
eng/devices/ios.cake --target=uitest-prepare --apiversion=latest
--dryrun --verbosity=quiet`: **passed**.
- Read-only Cake diagnostic target using the actual
`FindSimulatorRuntime` method and changed Appium-version block, against
`xcrun simctl list runtimes --json` / `xcrun simctl list --json`, with
`--boot=false`: **passed**. Installed iOS versions: 18.5, 26.0, 26.5,
27.1. `latest` → iOS 27.1; pinned `18.5` → iOS 18.5; `min` → iOS 18.5;
Appium platform version → `27.1`. No simulator was created or booted by
the passing diagnostic. Removed the diagnostic script afterwards.
- An initial diagnostic without `--boot=false` resolved the same
runtimes but failed in pre-existing Cake.AppleSimulator teardown (`Could
not locate executable`); rerunning with device boot/cleanup disabled
passed.
- `git diff --check`: **passed**.
- No pipeline tests added, per policy. Full UI suite not run locally;
requesting actual `maui-pr-uitests` validation via `/azp run
maui-pr-uitests` on this PR. CI outcome pending.


### Issues Fixed

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

No linked issue; fixes the setup failures in main UI-test build 1703706
(logs 4317, 4745, 4332).

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

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

Correct the Windows Shell flyout-clipping device test's native-layout
prerequisites without changing product behavior, skipping tests, adding
retries, or weakening its regression assertions.

Stop retaining the first `DataTemplate` instance. WinUI can prepare
template instances outside the live flyout or replace them. A handler
alone does not establish visual-tree membership or completed
arrangement. Select the loaded, positively arranged flyout item from the
actual Shell visual tree, then run the unchanged non-null clip and exact
rounded-width assertions. The readiness wait does not wait for the
assertion to become true.

Existing-fix search covered open and recently merged PRs. #40717
concerns custom TitleBar overlap, not flyout-template selection. #40692
addresses a different ContentButton reparenting test, and #40727
addresses Windows CarouselView position updates; neither is duplicated
here.

#### Validation and scope correction

- **Baseline red = main 1703707**, head `34964bfc72`. Shell fails in
both packaged attempts and the second unpackaged attempt; the first
unpackaged attempt passes. Raw first-attempt logs: 787/788;
second-attempt logs: 962/960. Both Windows Shell jobs also fail in
migration PR #40661 build 1703676 (logs 757/766).
- **Fix = PR CI 1703831** at `1e894622fe`: Windows Shell category **92
passed, 0 failed, 0 skipped in each mode**, logs
[757](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1703831/logs/757?api-version=7.1)
and
[758](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1703831/logs/758?api-version=7.1).
The unchanged Shell patch compiled and executed on Windows in that CI
run.
- The initial commit also attached the ContentButton replacement test to
a native window. **CI disproved that attempted fix**: build 1703831 Core
logs 621/625 still report expected frame `{X=5 Y=5 Width=170
Height=80}`, actual zero. That Button change has been reverted in a
normal follow-up commit; the net PR diff now contains only
`ShellTests.Windows.cs`.
- Static tracing of the Button path confirms `SetVirtualView(second)`
updates the panel's `CrossPlatformLayout`, maps the expected replacement
native content, and measures its requested size.
`ContentButtonLayout.Arrange` would assign the presented content's
managed frame through `StubBase.Arrange`; the current failure logs do
not prove why that arrange path is not reflected in the frame. No
speculative timing workaround or product fix is included.
- `git diff --exit-code 34964bf --
src/Core/tests/DeviceTests/Handlers/ContentButton/ContentButtonWindowsTests.Windows.cs`
— **passed**, proving the Button file is restored exactly to the
baseline.
- `git diff --check` — **passed**.
- Initial local `dotnet build Microsoft.Maui.BuildTasks.slnf -v:q` —
**passed**. Initial `dotnet format whitespace Microsoft.Maui.sln
--no-restore --include
src/Core/tests/DeviceTests/Handlers/ContentButton/ContentButtonWindowsTests.Windows.cs
src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Windows.cs
--verbosity quiet` — **passed**.
- Initial Windows cross-host build attempts on macOS were blocked by
native tooling: Core's Windows-only build reached `MakePri.exe` and
failed with exec format error; Controls' fallback with
`AppxGeneratePriEnabled=false` reached the native WinUI XAML compiler
and failed without `output.json`. No local Windows compilation or
runtime success is claimed.
- Revert/restore runtime verification **not run (no Windows host)**. The
Button source restoration is mechanically verified; updated PR CI is
requested separately.

CarouselView native-centering and HybridWebView coexistence failures did
not repeat across baseline attempts and passed the migration PR
comparison, so they remain unchanged. The recurrent NavigationPage crash
had `SettingTitleIconImageSourceDoesntCrash` in flight, but no dump and
an unproven cause; it is neither patched speculatively nor classified as
infrastructure. PageTransitions is outside this PR's scope.

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

Addresses the recurring Windows Shell flyout-clipping device-test
failure in builds 1703707 and 1703676. No separate tracking issue;
preserves regression coverage for #19542. The ContentButton replacement
failure remains unresolved and is no longer changed by this PR.

### 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>
kubaflo added a commit that referenced this pull request Nov 29, 2026
…l pass (#40774)

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

Self-reported assessment, not an independent review.

Assessed revision: `e35da1a9ca45e84919b81d03983e6d1a8e7e04a7`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 9/10 | ↑ TRX gate: real MTP TRX cases fail before,
pass after; revert fails, restore passes; empty jobs still fail.<br>↑ PR
CI 1703930 no longer rejects the all-skipped WebView TRX.<br>↑ Runner
emulation with the task's appended exit line: exit 1 before, 0
after.<br>↓ Runner fix not yet observed in CI. |
| Diagnosis confidence | 9.5/10 | ↑ Gate: log 454 of 1703917 rejected
Controls-WebView.trx (2/2 skipped).<br>↑ Runner: 1703917/450,
1703930/754 and 1703935/747 had zero failing categories but exited 1
right after the empty Uncategorized shard. |
| Evidence fit | 9/10 | ↑ Explains every Windows controls job failure
that had no failing tests.<br>↓ Real Windows crashes (NavigationPage,
HybridWebView 0xDEAD) remain out of scope. |
<!-- /copilot-assessment -->

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

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

### Target Branch

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

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

This fixes the device-test infrastructure added on `main` by #40661, so
it targets `main`.

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

`eng/scripts/Assert-TestResults.ps1` (step "Require real nonempty
successful TRX", added by #40661) requires **every** per-category TRX to
contain executed tests. On Windows the `WebView` category's only two
Controls device tests are skipped (`Fails on Windows`), so its TRX has
`total=2, executed=0, notExecuted=2`. The gate then fails the "Windows
controls packaged" and "Windows controls unpackaged" jobs even though
every category passed.

Evidence from `main` head `5613e880aa`, maui-pr-devicetests
[1703917](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703917):
- Log 450 (Windows controls packaged): every category "passed"; WebView
summary `total: 2, succeeded: 0, skipped: 2`.
- Log 454: `TRX '...\categories\WebView\Controls-WebView.trx' contains
no executed tests.`

Fix: a TRX whose results are all `NotExecuted` (skipped) is accepted.
The "no empty selection" guarantee moves to the job level: the job still
fails if no TRX executed any test, if there are no TRX files, or if a
TRX has no results. The failed/incomplete checks are unchanged.

**Validation.** Per repo guidance, no tests were added for pipeline
scripts. I ran the script with `pwsh` against real TRX files produced by
an xUnit v3 4.0.2 + Microsoft.Testing.Platform 2.5.1 (`--report-trx`)
probe, the same versions as this repo:

| Results directory | Before | After |
|---|---|---|
| all-skipped category TRX + category with executed tests (the CI case)
| FAIL | PASS |
| only executed tests | PASS | PASS |
| only an all-skipped TRX (nothing executed in the job) | FAIL | FAIL |
| no TRX | FAIL | FAIL |

Causal cycle on the CI case: fix PASS → change reverted FAIL → restored
PASS.

The Windows job outcome will be confirmed by this PR's
maui-pr-devicetests run. Not in scope: the unpackaged job's separate
HybridWebView test-host crash (exit 57005), and the core `[Button]
ReplacingVirtualViewUpdatesLayoutAndReleasesOldPress` failure.

**Second fix: Windows Controls category runner
(`eng/pipelines/common/device-tests-steps.yml`).** The Azure Pipelines
`powershell` step appends `if ((Test-Path -LiteralPath
variable:\LASTEXITCODE)) { exit $LASTEXITCODE }` to inline scripts. The
runner's last shard, `Uncategorized`, has no Windows tests and exits 8.
The runner treats that as "no tests", but never resets the exit code, so
the step failed even when every category passed. Seen in 1703917 log
450, 1703930 log 754 and 1703935 log 747: all categories "passed" or "no
tests on Windows", no failing categories, then `PowerShell exited with
code '1'`. The runner now ends with an explicit `exit 0`; real category
failures still `exit 1` before that point.

Validation: I ran the same shard sequence (a passing shard, then an
empty shard exiting 8) followed by the task's appended line, using `pwsh
-Command ". script.ps1"`. Before the fix it exits 1, matching CI; after
the fix it exits 0. The YAML parses.

### Issues Fixed

Fixes the `main` maui-pr-devicetests "Windows controls" jobs failing the
TRX gate on an all-skipped category.

### 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>
kubaflo added a commit that referenced this pull request Nov 29, 2026
…40801)

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

Assessed head: `f1c3419d9f6f0ed18b69f7cc83189797751fcfce`

**Change confidence: High**
- ↑ Fixture-only change; both tracked objects remain weakly owned, and
recovered Android peers stay alive through disconnect.
- ↑ Ten fixed runs and four restored runs passed; registration still
captures partially initialized handlers.
- ↓ The complete CI/platform matrix has not yet validated this head.

**Diagnosis confidence: High**
- ↑ Instrumentation captured a live SwipeView Java handle changing from
`32930` to `0` during focus-listener removal, before the
accessibility-delegate lookup.
- ↑ Reverting only the fixture fix immediately reproduced the original
image-test NPE.
- ↓ The precise finalizer interleaving is runtime-dependent.

**Evidence fit: High**
- ↑ Native device TRX verifies the same five affected fixtures and the
original accessibility NPE, including image-rendering failures.
- ↑ Baseline → fixed → reverted → restored execution was performed on
the same emulator and SDK.
- ↓ Local execution used Android API 36/arm64; CI uses API 33/Linux x64.
These are selected fixtures, not the entire Core suite.
<!-- /copilot-assessment -->

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

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

### Target Branch

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

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

This fixes the .NET 12 native device-test fixture on `main`.

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

### Description of Change

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

The weak-handler teardown introduced in #40661 can recover a handler
while its Android platform peer is already finalizing. `Handle !=
IntPtr.Zero` does not rule out queued finalization: the handle can
disappear during focus-listener removal, causing
`ViewCompat.GetAccessibilityDelegate` to receive a JNI null view.

Track the initialized platform view through its own short weak
reference. Android teardown recovers that reference separately, skips
peers that are already finalizing/disposed, and uses `GC.KeepAlive`
through the complete handler disconnect. This preserves collection
assertions' weak ownership instead of retaining every handler/view until
teardown.

Registration order and cleanup of partially initialized handlers are
preserved. No framework/product code changes are included.

**Rejected approach:** A product-only handle recheck before the
accessibility lookup stopped that NPE but merely exposed
`ObjectDisposedException` in subsequent Border/ContentView
`RemoveAllViews` cleanup (three failures across two of ten runs). Avoid
moving the guard between individual native calls; the fixture must not
disconnect an already-finalizing peer.

#### Validation

Local: macOS arm64, pinned SDK `12.0.100-alpha.1.26523.103`, CoreCLR,
Release, **Android API 36 arm64 emulator only**. CI's API 33/Linux x64
environment remains a validation gap.

All counted runs used the same five fixtures: SwipeView, Border,
ContentView, Slider and ShapeView. Fresh native TRX reports were checked
for unique run identities, exact fixture isolation, and genuine image
theory results.

| Revision | Runs | Result |
| --- | ---: | --- |
| Original fixture | 7 | 1 red run, 3 original accessibility NPEs; 2,510
passed, 84 skipped |
| Peer-lifetime fix | 10 | 0 failures; 3,590 passed, 120 skipped; all 50
PNG and 50 JPEG rows passed |
| Fix reverted | 1 | 1 original accessibility NPE in ContentView JPEG
rendering; 358 passed, 12 skipped |
| Fix restored | 4 | 0 failures; 1,436 passed, 48 skipped |

Commands and results:

- `dotnet build Microsoft.Maui.BuildTasks.slnf --configuration Release
--verbosity quiet` — **passed**, zero warnings/errors.
- `dotnet format Microsoft.Maui.sln --no-restore --include
src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBasement.cs
--exclude Templates/src --exclude-diagnostics CA1822` — **passed** (exit
0; workspace-loading warnings).
- Native selection/build/run command below — **passed with the fix** and
**failed with the original/reverted fixture**, as counted above:

```bash
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 \
  -Project Core -Platform android -DeviceUdid emulator-5580 \
  -IncludeClasses 'Microsoft.Maui.DeviceTests.SwipeViewHandlerTests,Microsoft.Maui.DeviceTests.BorderHandlerTests,Microsoft.Maui.DeviceTests.Handlers.ContentView.ContentViewTests,Microsoft.Maui.DeviceTests.SliderHandlerTests,Microsoft.Maui.DeviceTests.ShapeViewHandlerTests' \
  -RepoRoot "$PWD" -DotnetPath "$DOTNET_ROOT/dotnet" \
  -OutputDirectory artifacts/android-npe/restored-final -Timeout 00:15:00
```

- Subsequent repetitions reused that compiled selection through the
native command below — **passed/failed according to the revision
table**. The device's original `testResults.trx` was pulled and checked
independently of the host report.

```bash
dotnet test --project src/Core/tests/DeviceTests/Core.DeviceTests.csproj \
  --configuration Release --framework net12.0-android --no-build --no-restore \
  -p:RuntimeIdentifier=android-arm64 --device emulator-5580 --report-trx \
  --results-directory "$PWD/artifacts/android-npe/peer-fixed-series-$run"
```

Existing image/transform tests reproduce this shared teardown failure;
no new GC-timing-sensitive test was added. Full PR CI is pending.

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

CI-discovered regression; no separate issue is linked. Relates to
#40661.

Failure evidence: [main device-test build 1704155, Android Core log
659](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704155/logs/659?api-version=7.1).

### 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>
kubaflo added a commit that referenced this pull request Nov 30, 2026
#40844)

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

Self-reported assessment, not an independent review.

Assessed revision: `21f7caeb2041cdcf0382a632dca83e4a49365107`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 9.5/10 | ↑ On current `main` the project fails to
build with the same two xUnit1051 errors as CI. With this change it
builds with no warnings, and all 157 tests pass in Debug and
Release.<br>↑ Test-only change. The assertions are unchanged.<br>↓
Validated locally on macOS only. CI on this PR is pending. |
| Diagnosis confidence | 10/10 | ↑ The analyzer errors name both calls,
and restoring `main`'s version of the file reproduces them.<br>↑ #40661
moved the project to xUnit v3 after the branch of #40819 was created. |
| Evidence fit | 10/10 | ↑ These two errors are the only failure in the
four failed Run Unit Tests legs of maui-pr build 1704463, the PR build
of #40819. Every other test project passed in all four legs. |
<!-- /copilot-assessment -->

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

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

### Target Branch

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

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

The break is on `main`, where both #40819 and #40661 landed.

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

### Description of Change

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

`Controls.BindingSourceGen.UnitTests` doesn't build on `main`:

```
MayNotifyPropertyChangedTests.cs(51,5): error xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.
MayNotifyPropertyChangedTests.cs(67,16): error xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.
```

#40819 added `MayNotifyPropertyChangedTests` on a branch created before
#40661 moved the unit tests to xUnit v3. The xUnit v3 analyzers report
these two calls as errors.

The PR build of #40819 ([maui-pr
1704463](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1704463))
failed the four Run Unit Tests legs (Windows and macOS, Debug and
Release) for this reason only. The PR was merged with those legs red.
Until this is fixed, they fail on `main` and in every PR build that
merges `main`.

`Controls.Core.UnitTests` also fails on `main`, for an unrelated reason.
31 async leak tests have failed since #40824, whose own PR build
[1704502](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1704502)
failed them on all four unit-test legs. This PR doesn't fix those, so
the unit-test legs stay red until they're fixed too.

This passes `TestContext.Current.CancellationToken` to
`CSharpSyntaxTree.ParseText` and `Compilation.GetDiagnostics`, as the
other tests in the project already do. The assertions don't change.

Validation on macOS arm64 with the pinned SDK
12.0.100-alpha.1.26523.103:

| Command | Result |
| --- | --- |
| `dotnet build
src/Controls/tests/BindingSourceGen.UnitTests/Controls.BindingSourceGen.UnitTests.csproj
-c Debug -p:MauiPlatforms= -p:IncludePreviousTfms=false`, with `main`'s
version of the test file | Failed with the two errors above |
| The same command with this change, with `-c Debug` and with `-c
Release` | Succeeded, 0 warnings |
| `dotnet test --project
src/Controls/tests/BindingSourceGen.UnitTests/Controls.BindingSourceGen.UnitTests.csproj
-c Debug --no-build`, and the same with `-c Release` | Passed, 157 of
157 in each |

### Issues Fixed

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

No issue is filed. This fixes the build break on `main` from #40819.

### 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, keep "Allow edits by maintainers" on so the agent can
push to your branch; otherwise it 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>
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>

This branch had an error being deployed

1 failed and 1 inactive (outdated) deployments
skill-evaluation-pat-pool — a2ebf6fc Deployed Nov 27, 2026 by kubaflo via Harness hermeticity gate #38957
copilot-pat-pool — b15a52bf Deployed Nov 26, 2026 by kubaflo via agent #3359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants