Repository navigation
feat(samples): host theme apps in a Toolkit wrapper - #1654
Conversation
Port the Uno Themes isolated app host and deploy the combined WASM site for PR previews and main. Preserve standalone sample artifacts and add hosting smoke coverage. Desktop ALC reclamation still fails on macOS; record this limitation and the successful browser/runtime validation for draft review.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It introduces intricate collectible-ALC hosting, reflection-based runtime-cache sweeps, and custom MSBuild/CI packaging with self-acknowledged unresolved blockers (desktop ALC reclamation failing under the strict smoke gate, no linked issue), all of which require human judgment.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
This PR adds a new sample-app host, Uno.Toolkit.Samples.Wrapper (ToolkitSampleApp), that runs the existing Material, Cupertino, and Simple sample apps in-process inside collectible secondary AssemblyLoadContexts, porting the Uno Themes ALC-wrapper pattern. It replaces the "Simple-only" PR preview/main deployment with a single host exposing a theme picker (reload/unload plus ?app= deep links), while preserving the standalone sample heads used by runtime tests. The guest apps are adapted so each keeps its own App.Instance and finishes launch synchronously, so they behave correctly when Application.Current belongs to the wrapper.
Changes:
- New wrapper app: guest catalog, deep links, collectible-ALC loader (desktop/WASM/sweeps partials), reflection-based per-ALC cache cleanup, and a self-driving hosting smoke test with strict Release-desktop reclamation assertions.
- Guest adaptation:
App.Instancenow uses a private static instead ofCurrent as App,OnLaunchedis synchronous,UnoEnableAlcAppSupport=true, and shared-project call sites useApp.Instance. - Build/CI: custom MSBuild targets to package guest WASM payloads/fonts, a
build-wasm-guest-heads.shscript, WASM/desktop pipeline jobs (incl. a desktop hosting smoke), the static-web-app deploy switch, both solutions, README, and validation notes.
| File | Description |
|---|---|
samples/Uno.Toolkit.Samples.Wrapper/ToolkitSampleApp.csproj |
Wrapper project: TFM overrides, untrimmed publish, guest payload/font packaging targets. |
.../GuestHosting/GuestAppLoader*.cs |
Core loader + desktop/WASM/sweeps partials for boot/teardown/collection. |
.../GuestHosting/GuestAssemblyLoadContext.cs |
Collectible ALC with share-vs-isolate resolution. |
.../GuestHosting/GuestSharedAssemblies.txt |
Single-source share/isolate rules (runtime + build). |
.../GuestHosting/GuestHostingSmoke.cs, GuestAppDeepLink.cs, GuestAppCatalog.cs |
Smoke harness, launch selectors, hostable-app catalog. |
.../MainPage.xaml(.cs), App.xaml(.cs), Platforms/*, app.manifest, Properties/launchSettings.json |
Wrapper UI, app, platform heads, manifests. |
samples/Uno.Toolkit.Samples.{Material,Cupertino,Simple}/App.xaml.cs + .csproj |
App.Instance rework, synchronous launch, ALC support flag. |
samples/Uno.Toolkit.Samples/{Shell,Controls/OverviewSampleView,Content/Controls/SeedColorSamplePage} |
Shared call sites switched to App.Instance. |
build/workflow/*.yml, build/workflow/scripts/build-wasm-guest-heads.sh, .github/workflows/azure-static-webapp.yml |
Guest-head builds, desktop hosting-smoke job, deploy target switch. |
src/Uno.Toolkit.sln, samples/Uno.Toolkit.Samples.sln |
Register the wrapper with guest build-ordering dependencies. |
README.md, specs/toolkit-wrapper/progress.md |
Usage docs and validation notes. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1654.eastus2.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1654.eastus2.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1654.eastus2.azurestaticapps.net |
1 similar comment
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1654.eastus2.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1654.eastus2.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1654.eastus2.azurestaticapps.net |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
@Mergifyio backport servicing/10.0 |
✅ Backports have been createdDetails
Cherry-pick of dfa8b63 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |

PR previews and main deployments currently publish only the Simple sample. This change deploys a Toolkit wrapper that hosts Material, Cupertino, and Simple using the same secondary-AssemblyLoadContext pattern as Uno Themes.
PR Type
What is the new behavior?
?app=material|cupertino|simpledeep links.nullonce a second ALC has loaded the owner assembly uno#24581).The wrapper remains untrimmed because its guest assemblies load dynamically. No new package dependencies or framework/version changes are introduced.
Validation
CI and limitations
c3e2179cand verified on macOS and Linux CI. The full CI run on final commitd7932b7e(236398), CodeQL, and preview deployment passed. The deployed browser smoke also passed after the functional fix. The strict assertions remain enabled.Details and reproduction commands: validation notes.
PR Checklist
nullonce a second ALC has loaded the owner assembly uno#24581 (wrapper mitigation; does not close the upstream issue)