Repository navigation
Native CI cleanup - #23492
Native CI cleanup#23492
Conversation
A strong ALC reference in XamlParseContext pinned collectible secondary-app ALCs forever: parse contexts are retained long-term by ResourceBinding and ThemeResourceReference on elements reachable from non-collectible statics, and the lazy by-AssemblyName resolution could cache a collectible ALC inside a never-dying generated __ParseContext_ singleton. gcroot showed this field as the pinning edge in every chain to a leaked secondary Application (~+48 MB / +420K objects leaked per reload). - Store non-default ALCs via WeakReference<AssemblyLoadContext> - Keep a strong fast-path field for the process-immortal default ALC - Re-run lazy by-name resolution when a previously resolved target was collected, so a reloaded same-name assembly resolves to the NEW ALC (consistent with ResourceResolver's bump-to-live-registration behavior) - Post-unload lookups return null and fall back to host resolution per ResourceResolver's documented priority order Red/green: Given_XamlParseContext.When_Collectible_Alc_Unloaded_Then_Context_Does_Not_Pin_It Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-found cache Typed resource lookups that miss (e.g. implicit-style probes for secondary-app element types hosted in the host visual tree) were cached in _keyNotFoundCache as ResourceKeys strongly holding the RuntimeType. Element-level dictionaries live for the host's lifetime and are never touched by CleanupNonDefaultAlcCaches, so a single cached collectible RuntimeType pinned LoaderAllocator -> ALC -> the entire previous secondary-app graph. gcroot reported 10,378 root paths through one such cache entry on a host page's Resources. Skip the not-found cache for keys whose Type.IsCollectible is true (CanCacheKeyNotFound); re-probing such keys is cheap compared to leaking a whole secondary app. Non-collectible keys keep the existing caching behavior. Red/green: Given_ResourceDictionary_NotFoundCache (collectible type emitted via AssemblyBuilderAccess.RunAndCollect must be collectable after a miss; non-collectible keys still miss consistently) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Documents the problem (one full secondary-app graph leaked per reload, ALC never collected after Unload), the three gcroot-confirmed root causes in Uno.UI (XamlParseContext strong ALC capture, AlcContentHost projected-resource retention, ResourceDictionary not-found cache pinning collectible Types), the fixes, and the red/green + end-to-end validation (secondary Application count flat at 1 across 4 reload cycles vs +1 per reload before). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A DependencyObject stored as a value in a ResourceDictionary is now flagged
(IsResourceDictionaryItem) so it does not inherit or cache the DataContext of
the subtree it is applied into. This matches WinUI, where resources have no
DataContext.
Why it matters for collectible ALCs: a shared resource (e.g. a brush in a
GlobalStaticResources singleton) is rooted by a long-lived dictionary, yet it
is pulled into many short-lived subtrees via {StaticResource}/{ThemeResource}.
If it cached the inherited DataContext of one such subtree, it would keep that
DataContext — and everything it transitively references — alive forever. When
the subtree lives in a collectible AssemblyLoadContext, that retention pins the
whole context and prevents it from unloading. Only DataContext is blocked;
other inherited properties (FlowDirection, theme, …) still propagate.
Adds Given_ResourceDictionary_DataContext regression tests (flagging on store,
DataContext block, and a non-resource child still inheriting).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- ResourceDictionary: extract TryCacheKeyNotFound() so the collectible-key guard is applied
once instead of repeated at each key-not-found site (jeromelaban). Folding CanCacheKeyNotFound
directly into useKeysNotFoundCache was avoided because that variable also gates the
`modifiedKey { ShouldFilter = false }` transform used by the value lookup, so a helper keeps
lookup behaviour identical.
- DependencyObjectStore: back IsResourceDictionaryItem with a single-byte [Flags] StoreFlags
bitfield instead of a standalone bool field, so future per-store flags don't grow the
per-instance footprint (jeromelaban).
- Add When_Element_Binding_Uses_Inherited_DataContext_Then_It_Still_Resolves to guard that the
DataContext block (scoped to ResourceDictionary items) does not break binding propagation in
styles/resources (jeromelaban).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Addresses review on #23413: the spec documented an AlcContentHost fix and a runtime test that are not part of this PR. - Remove AlcContentHost as an implemented fix; move it to a follow-up note as a related, separately-tracked collectible-ALC pin - Drop the Given_AlcContentHost runtime-test bullet from Validation - Document the resource-DataContext fix (DependencyObjectStore IsResourceDictionaryItem + ResourceDictionary) that this PR actually contains, with its Given_ResourceDictionary_DataContext coverage - Note the end-to-end measurement reflects the full fix workstream Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The hot-reload client logged every frame whose Name it does not handle at Error. A frame can legitimately arrive on a scope this client participates in while being addressed to a different consumer (e.g. host-only diagnostics frames relayed over a shared scope). Those are benign and expected, so surfacing them as red console errors is misleading. Log them at Debug. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The reuse-on-reload warning claimed all state is immutable across hot-reload, but the AssemblyLoadContext is now held weakly and can lapse. Note it as the explicit exception — the reference only dies on ALC unload (teardown), not hot-reload — so contributors aren't misled about what may change across reloads. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per review request: add runtime tests (real visual tree, XAML-parsed) confirming
the ResourceDictionary DataContext block does not regress style-based binding
DataContext propagation. A resource Style carries no DataContext, but the element
it is applied to still inherits DataContext and its {Binding} resolves; an ordinary
child still inherits while a sibling resource does not.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The collectible-ALC and collectible-type reclamation loops did only Collect + WaitForPendingFinalizers. Reclaiming a collectible AssemblyLoadContext / LoaderAllocator reliably needs a second Collect after finalizers run, since finalization can release the last references keeping it alive — without it the assertions can intermittently fail on CI. Add the trailing Collect to both loops. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Native UI rendering is removed in 7.0 and Skia is the only renderer, so the NativeRenderer feature can never be selected. Drop it from the UnoFeature enum and the Uno.Sdk build schema. The 'nativerenderer' string is already stripped during evaluation (Uno.Features.targets), so no consumer behaviour changes. SkiaRenderer is intentionally kept as a now-implicit no-op for back-compat. Native Hot Reload wiring in Uno.WinUI.DevServer.targets is also kept on purpose: it serves the supported Skia-on-Android/iOS/WASM heads (gated on the platform identifier, not the renderer). Internal tracking: NativeRenderer feature removal (2102). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EUHMnPgHS11w9vBmrsP2XE
|
Claude finished @MartinZikmund's task in 2m 4s —— View job Review: Native CI cleanup
Overall Verdict: ✅ LGTM0 blocking issues. 1 informational note. 2 administrative items. Code ReviewThe two changes are clean, complete, and correct:
A search confirms no other Informational Note
Administrative Items
Validation: Code-review assessment only (no local build executed on this two-file deletion). |
Skia is always the renderer in 7.0 (Uno.Features.targets implies ';skiarenderer;' and strips ';nativerenderer;'), so the inverse '!skiarenderer' package branches are dead and never inject. Remove the native-only injections they gated: - Uno.UniversalImageLoader (native Android image loader) - Uno.WinUI.MediaPlayer.WebAssembly (native WASM-DOM media player) - the no-op SkiaSharp.Views removal on non-Skia WASM No behaviour change: every head already evaluates these to Skia. The positive ';skiarenderer;' gates are kept as they now mean "inject the Skia packages" for every head. Document SkiaRenderer as an implied no-op, and add a removal banner to the native-renderer docs. Internal tracking: SkiaRenderer no-op / renderer-branch cleanup (2062). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EUHMnPgHS11w9vBmrsP2XE
The legacy WASM-DOM head (Uno.WinUI.WebAssembly) is superseded by the Skia browser head (Uno.WinUI.Runtime.Skia.WebAssembly.Browser). With Skia always the renderer, the SDK's implicit injection for it is dead (the 'nativerenderer OR !skiarenderer' branch can never match). Remove the package from the Core manifest group and delete the dead injection block; browser-wasm apps already receive the Skia browser head. The Uno.WinUI.Runtime.Skia.X11 / .MacOS entries are intentionally kept: they are live Skia desktop runtime heads, not bootstrapper meta-packages. Internal tracking: packages.json / implicit-targets pruning (2103). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EUHMnPgHS11w9vBmrsP2XE
|
Claude finished @MartinZikmund's task in 2m 17s —— View job Review: Native CI cleanup
Overall Verdict: ✅ LGTM with nit0 blocking issues. 1 inline nit. 2 administrative items. Code ReviewAll seven changed files are clean and consistent:
A grep confirms the only remaining Inline FindingOne stale comment flagged on Administrative Items
|
Document the 7.0 move to Skia-only rendering: native renderer removal, the NativeRenderer feature removal with SkiaRenderer now implied, the retirement of the native-only Uno.WinUI.WebAssembly head (superseded by the Skia browser head Uno.WinUI.Runtime.Skia.WebAssembly.Browser), and native Android image-loader removal. Wire it into the upgrade TOC. Internal tracking: native-package-removal migration guide (2058, partial). The nuspec deletion and the produced-package CI guard land with the native-head/template cascade. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EUHMnPgHS11w9vBmrsP2XE
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23492/wasm-skia-net9/index.html |
|
Claude finished @MartinZikmund's task in 2m 55s —— View job Review: Native CI cleanup
Overall Verdict: ✅ LGTM with nit0 blocking issues. 1 inline nit. 2 administrative items. Code ReviewAll nine changed files are clean and consistent:
A grep confirms the only remaining Inline FindingOne stale comment flagged on Administrative Items
|
The legacy WASM-DOM head is removed in 7.0; browser apps use the Skia browser head (Uno.WinUI.Runtime.Skia.WebAssembly.Browser). Delete its nuspec and de-wire it from the pack pipeline (_NuspecFiles, the pack step, and the package diff), and retire the classic WASM-DOM template heads that still consumed it (UnoAppWinUI.Wasm, UnoAppWinUILinuxValidation.Wasm) with their solution and template-test wiring. Add a pack guard (ValidateNoNativeUIHeadPackages) that fails the build if a native UI rendering head package (Uno.WinUI.WebAssembly, Uno.WinUI.Runtime.WebAssembly) is ever produced again. Internal tracking: stop producing native UI packages (2058). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EUHMnPgHS11w9vBmrsP2XE
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23492/wasm-skia-net9/index.html |
|
Claude finished @MartinZikmund's task in 2m 47s —— View job Review: Native CI cleanup
Overall Verdict: ✅ LGTM with nit0 blocking issues. 1 inline nit (stale comment, same as prior reviews). 2 administrative items. Code ReviewAll 32 changed files are clean and correctly implement the native-renderer removal:
The only remaining Administrative Items
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23492/wasm-skia-net9/index.html |
…nning fix(alc): stop shared framework caches/resources from pinning collectible AssemblyLoadContexts
…n-frame-log-level fix(hot-reload): log unrecognized client frame at Debug not Error
fix(macos): Don't override dock icon for bundled apps
…ctionary-scope fix: Resolve duplicate materializedProvider local in ResourceDictionary
…v/mazi/nativecidrop2 # Conflicts: # src/SolutionTemplate/UnoAppWinUI/UnoAppWinUI.Wasm/UnoAppWinUI.Wasm.csproj # src/SolutionTemplate/UnoAppWinUILinuxValidation/UnoAppWinUILinuxValidation.Wasm/UnoAppWinUILinuxValidation.Wasm.csproj
|
Claude finished @MartinZikmund's task in 5m 13s —— View job Review: Native CI cleanup
Overall Verdict: ✅ LGTM with nit0 blocking issues. 1 inline nit (stale comment, same carry-forward from 3 prior reviews). 1 PR-description gap. SDK / Packaging changesAll clean:
ALC memory-leak fixes (spec 044)This PR also includes three correctness / ALC-leak fixes that are not mentioned in the PR description. All three are well-implemented:
Tests — The three new test classes ( PR description gapThe PR description describes only the SDK/packaging cleanup. The ALC memory-leak fixes ( Validation: Code-review assessment only (no local build executed). Build and runtime-test evidence provided via spec 044 and test additions. |
|
Nick Randolph seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Claude finished @MartinZikmund's task in 5m 46s —— View job Review: Native CI cleanup
Overall Verdict: ✅ LGTM with repeat nit0 blocking issues. 1 inline nit (same stale comment, 4th pass). 1 administrative item. New code introduced since prior reviews (ALC memory leak fixes)The PR now includes three substantive bug fixes for collectible-ALC memory leaks, merging in from the
The Tests — All four new test files are correct:
Inline FindingStale comment on Administrative ItemPR title — Validation: Code-review assessment. Build and runtime validation deferred to CI. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23492/wasm-skia-net9/index.html |
|
The build 218987 did not find any UI Test snapshots differences. |
The Uno.WinUI.MediaPlayer.WebAssembly project was removed with the native WASM-DOM heads (#23492, uno-private#2097); no package is produced, so the implicit reference in packages.json is dangling. The legacy WASM-DOM runtime ids were already gone; Uno.WinUI.Runtime.Skia.X11/.MacOS and the Uno.Wasm.Bootstrap group are still produced and kept. Related to unoplatform/uno-private#2103 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YCxZjE2cpi17oKR7SnseRE
GitHub Issue: closes unoplatform/uno-private#2058, closes unoplatform/uno-private#2103
PR Type:
🏗️ Build or CI related changes
What changed? 🚀
Follow-up to #23484, completing the SDK / packaging side of the Uno Platform 7.0 Skia-only native-drop. Skia is the only renderer, so the renderer feature, the dead renderer-selection branches, and the last native-only package are removed.
NativeRendererUnoFeature (uno-private#2102) — dropped from theUnoFeatureenum andSdk.props.buildschema.json. Thenativerendererstring is already stripped during evaluation, so consumers see no behaviour change.SkiaRendereris kept as an implied no-op for back-compat.!skiarendererpackage injections (Uno.UniversalImageLoader, nativeUno.WinUI.MediaPlayer.WebAssembly, the no-opSkiaSharp.Viewsremoval). The positiveskiarenderergates are intentionally kept — they now mean "inject the Skia packages" for every head. Added a removal banner to the native-renderer docs.Uno.WinUI.WebAssembly(uno-private#2058, Bump NuGet.VisualStudio from 4.5.0 to 4.6.4 #2103) — the legacy WASM-DOM head is superseded by the Skia browser head (Uno.WinUI.Runtime.Skia.WebAssembly.Browser). Removed from theUno.Sdkpackages.jsonmanifest + its dead injection, deleted the nuspec and its pack-pipeline wiring, and retired the classic WASM-DOM template heads (UnoAppWinUI.Wasm,UnoAppWinUILinuxValidation.Wasm) that still consumed it. Added aValidateNoNativeUIHeadPackagespack guard that fails the build if a native UI head package is ever produced again.doc/articles/migrating-to-uno-7.md.Intentionally NOT changed — the supported Skia heads still depend on these, so they stay:
Uno.WinUI.DevServer.targets— gated on the platform identifier, it serves Skia-on-Android/iOS/WASM Hot Reload.Uno.WinUI.Runtime.Skia.X11/.MacOS— live Skia desktop runtime heads (not bootstrapper meta-packages).Deferred to a separate branch:
Uno.UI-and-higher project heads) — the pure-native heads reference the kept nativeUno.Foundation/Uno.UWPheads and share theNet*MobileTFM properties with the kept Skia-mobile heads, so they can't be stripped in isolation. This lands with the native source/project deletion it gates.binaries_build_native_macos,SingleProject.*.targets,Android*features) target Skia-supporting infrastructure and need issue-text corrections, not code.Breaking changes
Uno.SdkNativeRendererUnoFeature is removed. Apps listing it should drop it; Skia is always used.Uno.WinUI.WebAssemblypackage is no longer produced. WebAssembly apps use the Skia browser head (referenced implicitly by theUno.Sdk). See Migrating to Uno Platform 7.0.PR Checklist ✅
Screenshots Compare Test Runresults.