Skip to content

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

Closed
mattleibow wants to merge 136 commits into
mainfrom
mattleibow-plain-dotnet-device-tests
Closed

mattleibow wants to merge 136 commits into
mainfrom
mattleibow-plain-dotnet-device-tests

Conversation

@mattleibow

@mattleibow mattleibow commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

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

Description of Change

Move repository testing from Helix/XHarness to plain dotnet test with Microsoft.Testing.Platform. Draft: native Windows failures, signed-package provisioning, the Blazor full-trimming coverage decision and complete current-head CI verification remain outstanding. Overall CI success and coverage equivalence are not claimed.

  • Migrate repository-owned xUnit suites and shared traits/data/lifetime APIs to xUnit v3 (package 4.0.2) with MTP 2.5.1. Keep Appium on NUnit with matching MTP-compatible hosts, fixture failures, retries and attachments.
  • Replace device runners with Android instrumentation and normal Apple MAUI application/scene lifecycle. Remove the visual test browser; preserve native UI dispatch.
  • Replace Helix submission and XHarness integration launching with direct CI execution and SDK tools. Preserve all five suites, runtime/category selections, genuine TRX, and nonzero/empty-selection failures.
  • Implement owned Windows signed-MSIX installation, real AUMID activation, original MTP arguments, package/PID identity checks and scoped cleanup. Keep unpackaged execution separate; preserve child/controller exits and final-report validation.
  • Update local/Cake/review-gate callers and documentation. Fix migration-exposed fixture state, thread-affinity, escaped asynchronous assertions and scope/native disposal defects without dropping assertions or theory rows.
  • Preserve legacy integration selectors through the shared MTP translator and escape artifact-path separators for MSBuild. Include executable infrastructure in the relevant CI triggers and discover its regression suites. Cake extracts and validates genuine iOS container TRX before cleanup, rejects stale reports and recovers owned-simulator setup retries.
  • Windows Cake native buildOnly, testOnly, test and buildAndTest now delegate to the existing owned native runner. Explicit project path, TFM, packaging and filter are retained; legacy XML/category-index discovery and direct activation loops are removed. Other native applications, including the device-test sample, can use ProjectPath instead of a known alias.
  • Remove the distributed MSBuild logger argument from the MTP test command, not from builds. Its -dl option was forwarded to the NUnit host and caused all UI shards to fail the command-line handshake. Build diagnostics, test binlogs, NUnit XML and TRX remain enabled.

Coverage and provisioning differences:

  • GoldenGate currently runs macOS 27/Xcode 27, not macOS 15/26. Restoring those hosts requires compatible execution agents and separate build/execution jobs. Defaults are honestly labeled; OS/architecture guards remain strict.
  • Windows currently uses the configured interactive Server 2022 image, not the former Windows 11 client queue. No client-specific equivalence is claimed.
  • Packaged Windows remains blocked by 0x800B0109: Add-AppxPackage rejects the temporary signer despite CurrentUser\TrustedPeople trust. An authorized owner must provide an accepted signer/image or explicitly approved provisioning. No machine trust or deployment-validation bypass was made. Both packaging modes remain in the default matrix.
  • Android uses the existing emulator-capable MAUI-DNCENG pool. Native xUnit requires an on-disk entry assembly, so test hosts set EmbedAssembliesIntoApk=false and PublishReadyToRun=false, including Release. Release optimization and Mono AOT remain; bundled-assembly/ReadyToRun loading are not covered.
  • Legacy .NET 11 Mono validation retains the baseline's explicit _DisableCheckForUnsupportedMonoMobileRuntime=true compatibility opt-in. The SDK otherwise rejects that runtime combination. This preserves legacy test coverage; it is not a claim that Mono is a supported .NET 11 product configuration. Local Mono validation uses the same opt-in, without modifying SDK files.
  • The non-shipping Blazor iOS test host uses its existing csproj ApplicationId consistently; the conflicting Info.plist identifier override was removed. This intentionally aligns the old iOS-only identifier with the project identity and fixes genuine report extraction.

Verified evidence:

  • All four Windows/macOS Debug/Release unit-test CI jobs passed in main run 1667051. Both Windows unit jobs also pass in main run 1667376. These results do not establish success of every main/integration job or the latest source.
  • Full local Core Debug/Release: 1,094 passed, three skipped each. Controls: 6,734 passed, 30 skipped. XAML Debug: 2,173 passed, eight skipped; Release: 2,153 passed, 14 skipped. Additional desktop validation covers source-generator, Resizetizer, Essentials and Graphics.
  • Actual Release Graphics: Android 33/33, iOS 54/54, Catalyst 54/54, genuine TRX. Android Mono/AOT, exact native selection and nonexistent-selection failures were exercised.
  • All four recorded iOS Controls shards pass on each runtime: General 1,285 passed / 14 existing skips; Shell 507 passed / no skips; CollectionView 76 passed / eight existing skips; HybridWebView 98 passed / one existing skip. Combined: 1,966 passed / 23 existing skips / zero failures, 1,989 total per runtime. CoreCLR report auditing finds no cross-shard selection overlap. Runs span fix revisions; this is not a single current-head full-matrix CI claim.
  • Native zombie diagnostics identified UIKit querying a deallocated ShellRenderer. Removing premature deep-disconnect from Apple fixture teardown fixes the reproduced use-after-free while retaining awaited native window/controller detachment. Speculative lifecycle-order experiments were reverted.
  • Native Mono HybridWebView logs measured WebContent startup around 23 seconds and GPU startup around 49 seconds, causing page-readiness failure before the exception assertions. Only page-startup polling gets a nominal 60-second budget; JavaScript-result polling remains at 25 seconds and exception assertions remain unchanged. Full 99-case validation subsequently passes on both runtimes. Predicate tests verify early success, finite failure and separate budgets.
  • Android MemoryTests: 63/63 on CoreCLR and Mono, no skips. Bounded collection checks actual weak-reference liveness, not rapid-attempt exhaustion before Java-side release completes. Two intentionally retained-view safeguards exercise the full ten-second bound; live objects are neither forcibly disposed nor accepted as collected. Apple/desktop retain original direct loops.
  • All nine existing collection-helper contracts pass on real Android CoreCLR and iOS, including intentional retained-reference failure, delayed release, empty and invalid inputs. The fixture ownership regression failed before cleanup and passes afterward on native iOS and Android.
  • The Android disposed-peer regression reproduces the CI ImageHandler teardown exception before its fix. Complete native Core passes afterward on CoreCLR and Mono: 3,018 passed / 72 existing skips / zero failures, 3,090 total each. Image/ImageButton regressions and original capture cases pass. APK inspection verifies the actual runtime; original native reports and proxy outcome agreement are retained.
  • Full native iOS Blazor: 48 passed / one existing skip, successful genuine simulator TRX extraction. Targeted native verification also passes all 24 Frame cases, twelve Entry focus variants, six Map/Window cases, ten Core UIKit/keyboard cases and 23 Essentials Mono cases.
  • Native integration launch contracts: 48 passed. Four NUnit/Appium hosts build; compatibility: 41 passed / three existing explicit-probe skips. Managed runner/controller: 39 passed / one Windows-only check skipped on macOS.
  • Scope cleanup validation: ten MauiContext unit tests passed, including real idempotent service-scope disposal. New native Windows regression rows require scope disposal after successful and throwing callbacks; full Windows execution still terminates before those late rows complete.
  • Latest caller/runner/pipeline regression run: 120 Pester checks passed. Windows native Cake task graphs compile for both packaging modes. Explicit-project execution passes a real Android native case with genuine TRX; invalid/missing/out-of-checkout projects and mismatched platform TFMs fail before launching the SDK.
  • Real NUnit discovery rejects -dl with exit 5, then discovers 3,270 tests without it. The remaining actual run options parse correctly and retain a deliberate empty selection as exit 8, producing genuine TRX rather than success. This is parser/discovery evidence, not a device-backed UI test pass.
  • The iOS Release sample builds with zero warnings/errors after removing its duplicate import. Cake freshness uses pre-run file/content evidence rather than sub-millisecond timestamp ordering. Pester also fails discovery/container errors even when FailedCount is zero.

Windows resource evidence and still-unresolved native behavior:

Device run 1667516 produced a genuine 13 MB native fail-fast dump through temporary PID-scoped ProcDump. Exception 0xC0000409 carries E_OUTOFMEMORY (0x8007000E). Exact Microsoft symbols resolve the fault to CTitleBar::InitializeComposition in Microsoft.UI.Windowing.Core.dll. The dump contains 18,951 kernel handles, including 8,027 sections and 7,978 DX composition objects.

The attachment fixture also had a real scope-lifetime defect: disconnecting Window.Handler before Window.Destroying lost the context needed to dispose the child service scope. Cleanup now retains that actual context and disposes it in finally. That correction did not resolve the native termination: uninstrumented device run 1668198 still exited 57005 / 0xDEAD while SingleShellSectionWithMultipleChildren was active, after 496 recovered rows. The remaining native-resource ownership/root cause is unresolved. No forced GC, disabled title bar, increased resource limit, skip or weakened assertion was added.

The same Windows run reports the ScrollView reload focus assertion and a CarouselView native-scroll assertion. These remain unmatched; they are not called flakes. All temporary ProcDump preparation, monitor and generic-template hooks are removed, so validation is uninstrumented. Permanent MTP diagnostics and owned-PID event collection remain.

Main CI coverage blocker: main run 1667491 passed 32/33 jobs. RunOnAndroid passed ten cases and failed Blazor/net11/Release/full installation with IL2111 on Router.NotFoundPage.set. Correct buildProps forwarding now honors TrimMode=full, which baseline accidentally discarded, exposing unsupported Blazor full trimming rather than a native-launch failure. No analyzer suppression, dropped case or silent restoration of ignored properties was made. A coverage decision or upstream support is required.

UI CI handshake correction: UI run 1668195 failed all 123 shards before test execution with MTP invalid-arguments exit 5. The shared Cake test caller forwarded the MSBuild-only distributed logger. The current correction removes that invalid test-host argument while retaining build logging, test binlogs and report reconciliation. Fresh device-backed UI confirmation is required.

Remaining native Windows ownership/focus behavior, accepted signed-package provisioning, the Blazor full-trim contract, full current-head native/integration matrices, device-backed Appium and installed-workload template coverage prevent merge readiness.

Apple's proxy does not accept host --report-trx or automatically publish native results. The app produces genuine TRX; callers copy it instead of synthesizing stdout results. Reporting polish is separate.

Native CI uses maui-pr-devicetests; Appium uses maui-pr-uitests. The Copilot pipeline is unchanged.

Issues Fixed

No product issue is being closed. The separate Apple reporting limitation is described in dotnet/macios#27251 and is not fixed by this PR.

mattleibow and others added 2 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>
@github-actions

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 12:59 — with GitHub Actions Failure
@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 12:59 — with GitHub Actions Failure
@github-actions

This comment has been minimized.

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>
@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 13:06 — with GitHub Actions Failure
@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 13:06 — with GitHub Actions Failure
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

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>
@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 13:13 — with GitHub Actions Failure
@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 13:13 — with GitHub Actions Failure
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>
@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 13:33 — with GitHub Actions Failure
@mattleibow
mattleibow had a problem deploying to skill-evaluation-pat-pool November 5, 2026 13:33 — with GitHub Actions Failure
@kubaflo

This comment has been minimized.

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

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

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

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

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

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

mattleibow and others added 2 commits November 10, 2026 19:25
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mattleibow

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

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

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

mattleibow and others added 3 commits November 10, 2026 20:40
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>
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@MauiBot

MauiBot commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

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

Result INCONCLUSIVE Platform iOS


🧪 Gate analysis — click to expand

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

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

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

No immutable without-fix baseline was prepared.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — 2 findings

Reviewed commit 0489243.

Source assessment incomplete (10/17 dimensions); finding count is partial.

See inline comments for details.


function Trust-WindowsTestCertificate {
param($Certificate)
$store = [Security.Cryptography.X509Certificates.X509Store]::new('TrustedPeople', 'CurrentUser')

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.

[moderate] Windows Platform Specifics - Every packaged run generates a fresh self-signed certificate, but this helper trusts it only in CurrentUser\TrustedPeople. MSIX deployment requires a machine-trusted signing chain, so Add-AppxPackage rejects this signer with 0x800B0109 before activation or test execution. The local packaged runner and all five default packaged CI suites use this path without an accepted-signer alternative. Provide an authorized signing/provisioning path without bypassing deployment validation. The installation tests mock Add-AppxPackage and cannot detect this failure. This previously reported finding remains present.


Assert.True(DotnetInternal.Build(projectFile, config, target: "Install", framework: $"{framework}-android", properties: BuildProps, output: _output),
Assert.True(DotnetInternal.Build(projectFile, config, target: "Install", framework: $"{framework}-android", properties: buildProps, output: _output),

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.

[moderate] Trimming and AOT Compatibility - Forwarding buildProps now applies TrimMode=full to the unconditional maui-blazor/net11.0/Release/full theory row. The template's Components/Routes.razor assigns Router.NotFoundPage, whose reflected setter access conflicts with its DynamicallyAccessedMembers requirements under full trimming (IL2111), as documented beside the disabled equivalent in AppleTemplateTests.cs. BaseBuildTest sets TreatWarningsAsErrors=true, and TemplateTestExtraTargets does not guard this path, so the selected RunOnAndroid case fails during Install before AppLaunch executes. This previously reported case remains present: establish an explicit supported full-trim coverage contract or an upstream fix rather than discarding TrimMode or suppressing the diagnostic.

@kubaflo

kubaflo commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Closed in favour of #40661

This branch had an error being deployed

1 failed and 1 inactive (outdated) deployments
skill-evaluation-pat-pool — 04892430 Deployed Nov 10, 2026 by mattleibow via Harness hermeticity gate #34158
copilot-pat-pool — 9e90311f Deployed Nov 5, 2026 by mattleibow via conclusion #2717
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants