Repository navigation
fix(samplesapp): Root the head assembly for android trimming - #24353
Conversation
The netcoremobile head rooted the samples assembly with RootMode=All on every one of its targets, and the consolidated head kept that only for iOS/tvOS. Android+NativeAOT publishes with PublishTrimmed and TrimMode=full and has no managed entry point to root the app assembly from, so the samples and the runtime-test harness — reached only by reflection — are trimmed out of the head. The whole Android+NativeAOT runtime-test run then aborts on the first test's cleanup with `ArgumentNullException (Parameter 'xamlRoot')`: UnitTestsControl never reaches the live visual tree, so its Loaded handler never publishes the XamlRoot the harness cleans popups with. The generated Uno.UI.Tasks descriptors are not a substitute — they only preserve properties on [Bindable] types and attached-property accessors. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FMa5PnRraRxZNYL61Grv9z
|
Claude finished @MartinZikmund's task in 2m 20s —— View job Claude's Review
Verdict: Ship (after the self-flagged temporary CI change is reverted)Issues found: 1 (informational / merge-blocking checklist item, not a code defect) — see inline comment on What I verified
CI condition change — traced the pipeline wiring ( No other correctness, style, or test-coverage issues found. Conventional Commit format is correct for both the PR title and the two commits. |
There was a problem hiding this comment.
🟡 Changes recommended
It currently removes the PR guard for an expensive CI stage in a way that would permanently run Android+NativeAOT tests on every PR if merged.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes Android + NativeAOT Skia runtime-test runs aborting after SamplesApp head consolidation by ensuring the SamplesApp head assembly is rooted for trimming, preventing reflection-reached samples/test harness code from being removed during trimmed publish.
Changes:
- Root
SamplesAppwithTrimmerRootAssembly RootMode="All"for all Skia TFMs (including Android) to keep reflection-reached test infrastructure intact under full trimming. - Temporarily removes the PR-skip condition for the Android+NativeAOT Skia test job to validate this fix in CI (intended to be reverted before merge).
File summaries
| File | Description |
|---|---|
| src/SamplesApp/SamplesApp/SamplesApp.csproj | Expands the trimmer rooting condition to all Skia TFMs so Android trimmed publishes keep SamplesApp/test harness code. |
| build/ci/tests/.azure-devops-tests-android-nativeaot-skia.yml | Temporarily enables Android+NativeAOT Skia tests on PR builds by removing the PullRequest guard. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24353/wasm-skia-net9/index.html |
a6720a5 to
d207da6
Compare
|
Claude finished @MartinZikmund's task in 1m 48s —— View job Claude's Review (updated after
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24353/wasm-skia-net9/index.html |
GitHub Issue: closes #24352
PR Type:
🐞 Bugfix
What changed? 🚀
Every Android + NativeAOT runtime-test group has been aborting since the SamplesApp head consolidation (#24046) — two NUnit results per group instead of ~1500, the second being the harness' synthetic
Runtime exception:UnitTestsControl.OnLoadedis what publishesTestServices.WindowHelper.XamlRoot, and it never runs — the control never reaches the live visual tree — so the first test's general cleanup throws and the run is abandoned.Root cause. The removed
SamplesApp.Skia.netcoremobilehead rooted the samples assembly withTrimmerRootAssembly RootMode="All"on every one of its targets. The consolidated head restored that only for iOS/tvOS (0cf84f8). Android + NativeAOT publishes withPublishTrimmed=true/TrimMode=fulland has no managed entry point to root the app assembly from, so the samples and the runtime-test harness — both reached only by reflection — get trimmed out of the head.Tests - Android Skia(Mono, same head, same commit) passes with 1242–1475 results in the same CI run, which is what isolates it to the trimmed publish.Confirmed by diffing the
TrimmerRootAssemblyitems in the two CI build binlogs:0950717)6dfcb8f)Uno.UI.RuntimeTestsRootMode=AllRootMode=AllUno.UI.ExtrasSamplesApp.SkiaRootMode=AllThe generated
Uno.UI.Tasksdescriptors are not a substitute: they only preserve properties on[Bindable]types and attached-property accessors.Fix. Root
SamplesAppwithRootMode="All"on every Skia TFM, as the old samples-library root was — desktop and wasm don't trim here, so it costs them nothing.Validated on CI. The
Tests - Android+NativeAOT Skiastage is gated onne(variables['Build.Reason'], 'PullRequest'), which is why no PR ever exercised it and the regression could only appear post-merge. That guard was temporarily dropped on this branch to run the stage against the fix — build 231546, group 0: 1472 results, 0 failed, matching the pre-regression baseline exactly (2 results, 1 failed before the fix). The guard has since been restored, so the stage will not appear on this PR's checks.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01FMa5PnRraRxZNYL61Grv9z