Skip to content

[inflight/current] Fix Windows device-test execution and ScrollView retention - #38679

Closed
kubaflo wants to merge 13 commits into
inflight/currentfrom
kubaflo-inflight-windows-device-tests
Closed

kubaflo wants to merge 13 commits into
inflight/currentfrom
kubaflo-inflight-windows-device-tests

Conversation

@kubaflo

@kubaflo kubaflo commented Sep 19, 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!

Description of Change

Restore reliable Windows device-test execution on inflight/current. All 10 Windows packaged/unpackaged work items are verified passing on commit 3c230b5ff49a7b4a77e126ca2023f7919078f14c, build 1603807. This is a Windows verification result, not a claim that every platform or PR check is green.

  • Propagate [Windows] Fix device-test SDK resolution and hidden crashes #38678: resolve Helix SDK payloads with MicrosoftNETSdkPackageVersion, retaining the published servicing suffix.
  • Propagate fail-closed Windows execution: retain the packaged process handle to retrieve the actual exit code, reject nonzero/unknown statuses, validate category XML, preserve reported test outcomes, and emit failed infrastructure results for missing/malformed output or dumps.
  • Propagate the complete Windows CLI shutdown repair: HomePage explicitly requests outcome-aware termination instead of killing its process after RunTestsAsync. The hosts exit only after XHarness closes its result writer. XHarness defaults TerminateAfterExecution to false, so changing its callback alone was insufficient. Discovery exits 0 after closing the category file; exceptions and invalid categories fail. Interactive and non-Windows behavior remain unchanged; no exit-code whitelisting.
  • Propagate Map-test synchronization from [net11.0][Windows] Repair device tests and reject incomplete runs #38677 via [Windows] Fix device-test SDK resolution and hidden crashes #38678: await native layer initialization and queued scripts before teardown, without changing assertions or timeout.
  • Route all four native ScrollView callbacks (Loading, Loaded, Unloaded, ViewChanged) through a weak handler proxy. Preserve explicit unsubscription, temporary tab-stop ownership/restoration, generation checks, and existing focus behavior. Ignore obsolete ViewChanged callbacks after disconnection.
  • Use a private weak layout proxy for the ScrollView padding panel, which otherwise strongly references its owning handler through CrossPlatformLayout. Forward measure/arrange while the owner exists; use the existing empty-layout behavior after collection. No global MauiPanel or public interface changes. This additional ownership edge was exposed by the content/reload leak tests and its repair is now verified in both variants.
  • Remove temporary diagnostic tests. Retain the original leak test and every existing focus regression; add two content/reload leak cases that also verify programmatic scrolling completes on the same native handler. Use the existing dispatcher-idle helper before removal because scroll completion can resume inline in native layout.

Issues Fixed

SDK payload submission failure and hidden Windows crashes/incomplete test runs, plus the inflight-only ScrollView retention regression exposed by actual execution. Companion to #38678 and #38677; no merge requested.

Final Windows Verification

Build 1603807, Helix 98dbb962-e13f-41a7-bf93-0994bab1fa52, source 3c230b5ff49a7b4a77e126ca2023f7919078f14c, merge 2f595577f1881013e7f8825b98ba0e5f1524968f. Windows task succeeded; its log 137 confirms both submission of this exact Helix job and completion of all 10 work items.

Counts below apply separately to each packaged and unpackaged variant. All ten work items exited 0.

Suite (both variants) Total Passed Existing skips
Controls 971 938 33
Core 2,120 2,009 111
Essentials 272 258 14
Graphics 33 33 0
MauiBlazorWebView 25 21 4

Across both variants: 6,842 test executions, 6,518 passed, 324 existing skips, 0 failures, 0 XML errors. No new skips or relaxed assertions.

Validation inspected all 100 raw category XML files, 10 aggregate XML files, and 10 console logs. It matched exact category inventories and test identity/outcome multisets, checked assembly and collection counters, rejected missing/malformed output, verified launcher/native exits, and checked uploaded files for dumps (none). Controls has all 46 categories in each variant, with all 29 ScrollView tests and both Map tests passing. Packaged Controls also records all 47 native/launcher exits as 0 (category discovery plus 46 categories). Both new content/reload GC cases collect the view, handler, and native wrapper, and the original leak/focus tests remain passing.

The prior unpackaged CarouselView high-physical-range failure did not recur: its test and production code are unchanged and the exact test passed in both final variants. Its earlier intermittent cause is not claimed fixed or classified as proven infrastructure.

Investigation Evidence and Local Validation

  • Original SDK failures: builds 1603206, log 137, and 1603127, log 146. SDK resolution is now verified through actual successful submission.
  • All 40 local regression checks pass: 5 SDK, 17 runner, 18 headless subprocess/caller cases. Real AddDotNetSdk evaluation resolves the full servicing Windows archive. Windows native builds were verified in CI because local macOS cannot execute MakePri.exe.
  • Build 1603594 first executed all 10 Windows items; both Controls variants exposed the original ScrollView leak.
  • Build 1603624 showed that weakening only the three new lifecycle subscriptions was insufficient while ViewChanged still strongly retained the handler; that partial candidate was removed.
  • Build 1603635 tested baseline/unfocus/tab-stop clearing/disconnection in both variants. Only disconnection released all three objects. Failed cases had no focus target or tab-stop binding after removal, ruling out those cleanup workarounds.
  • Build 1603678, Helix e13ab778, isolated disconnect operations: in both variants only removing all four native subscriptions or disconnecting released all three objects. Removing one subscription, removing the focus mapping, or clearing the additional platform field did not. Each diagnostic ScrollView category reported 36 tests, 28 passed, 8 failed, 0 skipped. This motivated complete weak event ownership, not another focus/binding change.
  • Build 1603709 compiled all 10 Windows payloads. Packaged Controls passed both Map cases but its ScrollView category crashed with empty XML, correctly rejected by the strict merger. Exact WinUI symbols locate the access violation at CFrameworkElement::ArrangeCore+0x2f5, writing through null CUIElement::GetLayoutStorage() after an arrange callback. The new test now yields through dispatcher idle after scroll completion before detaching content. The crash did not recur in either subsequent candidate run; the native location alone is not a complete managed root-cause stack.
  • Build 1603730, Helix 76bec800, completed all 10 items. All 27 original ScrollView tests passed in both variants, but the two added content/reload GC cases failed while the padding panel still strongly retained its layout owner. The only subsequent source change was the private weak layout-owner proxy; those same assertions pass in final build 1603807.
  • The shared CLI correction fixes the separate native status -1 observed in earlier runs: HomePage.Process.Kill() was still executing because the XHarness termination option defaulted to false. Do not whitelist that status or terminate before XML writers close.

No tests are skipped or assertions relaxed. No merge requested.

Use the repository SDK package version instead of the installed SDK product version, which loses the servicing suffix required by the download feed. Add MSBuild evaluation regression coverage and document the failure signature.

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

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Preserve the existing temporary tab-stop behavior while routing native load events through a weak proxy and avoiding strong handler/view captures in queued restoration callbacks. Keep the existing ScrollView leak and focus regression tests unchanged for Windows CI verification.

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

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@kubaflo kubaflo changed the title [inflight/current] Fix device-test Helix SDK payload version resolution [inflight/current] Fix Helix SDK resolution and Windows ScrollView callback retention Sep 19, 2026
@kubaflo

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Remove the ineffective weak-callback candidate and compare native focus, tab-stop state, and disconnection without changing existing leak assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kubaflo kubaflo changed the title [inflight/current] Fix Helix SDK resolution and Windows ScrollView callback retention [inflight/current] Fix Helix SDK resolution and investigate Windows ScrollView retention Sep 19, 2026
@kubaflo

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

kubaflo and others added 5 commits September 19, 2026 17:20
Retain packaged process handles before waiting and propagate process failures. Validate and merge category results without hiding malformed XML or crash dumps, retaining valid outcomes and explicit infrastructure failures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the shared fix from 0ac276e: observe native JavaScript layer initialization and drain queued updates while the test window remains alive. Keep both lifecycle assertions and the existing timeout unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve CS4036 from Windows build1603641 by importing System for IAsyncOperation<string>.GetAwaiter.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Supply schema-v1 environment, framework and run date/time attributes so downstream reporters can ingest the synthetic failed tests. Regression assertions failed before these attributes were emitted.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Focus and binding cleanup did not release any retained reference in either Windows variant. Split the successful handler-disconnect control into native event, focus mapping, and platform-field interventions without weakening the original tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kubaflo kubaflo changed the title [inflight/current] Fix Helix SDK resolution and investigate Windows ScrollView retention [inflight/current] Fix Windows device-test SDK and crash reporting; diagnose ScrollView retention Sep 19, 2026
@kubaflo

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

WinUI Application.Exit returns -1 even for passing test runs. Defer explicit outcome-based process termination until XHarness RunAsync has disposed its XML writer; propagate exceptions and retain interactive mode. Nine subprocess regressions compile the real host classes against XHarness lifecycle stubs, verifying both exit codes and persisted output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Route all four native lifetime and scrolling callbacks through a weak handler proxy, preserving focus restoration and explicit event unsubscription. Replace temporary diagnostics with content/reload collection coverage and keep the original leak and focus assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kubaflo kubaflo changed the title [inflight/current] Fix Windows device-test SDK and crash reporting; diagnose ScrollView retention [inflight/current] Fix Windows device-test execution and ScrollView event retention Sep 19, 2026
@kubaflo

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

kubaflo and others added 2 commits September 19, 2026 20:14
The visual runner CLI path used the default XHarness termination option, then killed its own process after receiving results. Explicitly request outcome-based termination after writer disposal and cover the actual HomePage caller with default options.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep scroll-completion and collection assertions while avoiding inline removal from a native layout callback.

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

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@kubaflo

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Use a private weak layout proxy for the ScrollView padding panel, preserving measurement and arrangement while the layout owner is alive. Keep both content/reload leak regressions and all lifecycle assertions unchanged.

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

kubaflo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@kubaflo kubaflo changed the title [inflight/current] Fix Windows device-test execution and ScrollView event retention [inflight/current] Fix Windows device-test execution and ScrollView retention Sep 19, 2026
@kubaflo kubaflo closed this Sep 19, 2026
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.

1 participant