Repository navigation
Conversation
54aa3e0 to
7375453
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
|
|
The build 227523 found UI Test snapshots differences: Details
|
7375453 to
69fe16b
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24070/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24070/docs/index.html |
|
The build 227732 found UI Test snapshots differences: Details
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24070/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24070/docs/index.html |
|
The build 227846 found UI Test snapshots differences: Details
|
601f860 to
e681002
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24070/wasm-skia-net9/index.html |
|
The build 228244 found UI Test snapshots differences: Details
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24070/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24070/docs/index.html |
|
The build 228327 found UI Test snapshots differences: Details
|
The per-member templated-parent assignment has been dead since it was parked behind an undefined USE_NEW_TP_CODEGEN in Aug 2024, and had drifted out of compiling: closureName no longer exists in that scope (it is now writer.AppliedParameterName). It also could never have worked in a consumer app. Generated XAML compiles into the app's own assembly, where the internal FrameworkElement/DependencyObject SetTemplatedParent members do not resolve at all (CS1061) -- in-repo heads only got away with it via InternalsVisibleTo. Route the emission through a new public [EditorBrowsable(Never)] MarkupHelper.SetTemplatedParent instead, the same escape hatch the generator already uses for SetVisualStateLazy. The helper takes DependencyObject rather than FrameworkElement: template members needing a templated parent include AdaptiveTrigger, VisualState and Setter. Both changes stay inert until USE_NEW_TP_CODEGEN is defined. Towards #8339. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The templated-parent codegen emitted __settings into the generated apply block,
but under hot reload that block is a class-level method
ApplyTo_X(T __p1, Scope __that, NameScope __nameScope) with no such symbol --
so the path could only ever have compiled with UnoForceHotReloadCodeGen=false.
Since _isHotReloadEnabled defaults to _isDebug, that meant every Debug build.
Pass __settings as a fourth parameter rather than capturing it, matching why
__that and __nameScope are already passed ("to avoid closing on __that and
__namescope when running in HotReload"), with a 3-arg GenericApply overload to
carry it. Only apply blocks for DependencyObjects inside a FrameworkTemplate
take the parameter, since __settings does not exist elsewhere.
Verified on a template-heavy page: 13 emitted apply methods take __settings,
13 call sites pass it, 13 templated-parent assignments -- with hot reload at its
default. Still inert until USE_NEW_TP_CODEGEN is defined. Towards #8339.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Pairs the two toggles that activate the per-member templated-parent assignment: the USE_NEW_TP_CODEGEN define in the generator, and _isLegacyTemplate = false, which retires the ambient TemplatedParentScope injection from the DependencyObjectStore ctor. Renders 5/6 of the SimpleTestApp probe cases. The outstanding case is a DataTemplate built imperatively through FrameworkTemplate(Func<View?>): codegen cannot reach objects that were never declared in XAML, so those members lose their templated parent. WinUI has no equivalent ctor. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The per-member templated-parent assignment was gated behind USE_NEW_TP_CODEGEN, a symbol defined nowhere. Removes the define, both #if blocks, and the #else fallback that hardcoded needsTemplatedParent to false, so the emission is now the only code path. Also drops the nullable annotation from the __settings parameter of the hot-reload apply callback: generated files carry no #nullable context, so the '?' raised CS8669 and failed the generator suite's zero-diagnostics assertion. Regenerates the 14 affected goldens, which had been stale since the codegen repair landed (59 of 482 generator tests were failing before this). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Deletes the ambient TemplatedParentScope and the public FrameworkTemplateBuilder surface it existed to serve. The per-member codegen and the XamlReader path both assign the templated parent directly, so nothing depended on the scope any more: _isLegacyTemplate was a const false and the scope's guard only fired when true. Both preprocessor symbols are gone. ENABLE_LEGACY_DO_TP_SUPPORT despite its name gated the live templated-parent storage (_templatedParentWeakRef, Get/SetTemplatedParent2), which every TemplateBinding reads through, so its members are kept unconditionally and only the guard is removed. Removed: - TemplatedParentScope, and its hook in the DependencyObjectStore ctor, which ran on every DependencyObject construction - public FrameworkTemplateBuilder delegate, its four ctors, and AdaptFrameworkTemplateBuilder - public no-op DependencyObjectStore.SetTemplatedParent(FrameworkElement) - DependencyObjectStore.ApplyTemplateBindings and its DependencyPropertyDetailsCollection counterpart, dead once the scope's only call site went away - VisualState/VisualTransition.FromLegacyTemplate and ElementStub's _fromLegacyTemplate, reducing both EnsureMaterialized bodies to builder.Invoke() The [DynamicDependency] trim guards in XamlObjectBuilder are kept: they protect the surviving ctor against the reflective Activator.CreateInstance call. BREAKING CHANGE: FrameworkTemplateBuilder and the (object, FrameworkTemplateBuilder) ctors of FrameworkTemplate/DataTemplate/ControlTemplate/ItemsPanelTemplate are removed, along with DependencyObjectStore.SetTemplatedParent(FrameworkElement). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Replaces the NewFrameworkTemplateBuilder delegate with System.Func behind a per-file `using Builder = ...` alias. With the legacy FrameworkTemplateBuilder already gone, no Uno-specific template delegate type remains: callers and tooling see only a Func. The alias is repeated per file because C# aliases are file-scoped and cannot reference other aliases, so each spells out the types fully qualified. BREAKING CHANGE: NewFrameworkTemplateBuilder is removed. The builder ctors of FrameworkTemplate/DataTemplate/ControlTemplate/ItemsPanelTemplate and TemplateManager.UpdateDataTemplate now take Func<object?, TemplateMaterializationSettings, UIElement?>. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
x:Load elements and VisualState content are created after the template builder returned: they capture the materialization settings and call OnMemberCreated later, a path the existing tests only reach through a ControlTemplate host. Adds the DataTemplate host, the dematerialize/re-materialize round trip, a state whose key-frame value can only resolve through the templated parent, and a state setter whose target is itself deferred. Closing the settings right after the builder returns turns all four red while the eager-path tests stay green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A pooled template root outlives the host that materialized it: once another host dequeues it, every member has to point at the new templated parent. Lazily materialized members (x:Load, VisualState) are created outside the pool's snapshot of the template members, and the settings they capture to reach the templated parent are fixed at materialization time. Hosts the template on a ContentPresenter -- the only host going through the pooled path, as Control.Template is materialized uncached -- and drives the reuse by detaching it, asserting the root came back from the pool and was handed to the second host before looking at any templated parent. The three are ignored pending #18317, each failing on a distinct piece: the tracked member snapshot is armed by the public (permanently false) IsPoolingEnabled, so nothing is ever tracked; lazy members are absent from that snapshot once it is armed; and a member materialized after the recycling reads its parent from the settings captured by the host that pooled the root. Arming the snapshot alone turns the eager-member test green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Reusing a pooled root scanned a per-template list of materialized entries, dereferencing a weak reference per element, and that list only shrank when the scavenger ran. Keying the members by the root they belong to makes the lookup a single hash probe and drops an entry with its root. Also removes the entry's own weak reference to the root -- the key is the root -- and the now-unused template argument on TrackMaterializedTemplate. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The materialization settings allocated a GC handle per template materialization. A DependencyObject already carries a self weak reference, which also applies the native-alive check a bare WeakReference skips, so TemplatedParent now resolves through the same path as DependencyObject.GetTemplatedParent. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The settings type has no WinUI counterpart -- it exists so a template builder can be handed its templated parent -- so it belongs next to the two other pieces of that contract, `FrameworkTemplateBuilder` and `TemplateManager`, rather than under `Microsoft.UI.Xaml`. Generated XAML spells the type in three places (the `Build` entry point, each `Build_*` member method, and the lazy-apply handler signature), so this regenerates 14 goldens. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
XML comments cannot contain '--', so generatepkgdiff crashed while deserializing the ignore file, before any diffing happened. Replace the two BC01 dash separators with em dashes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
7b13145 to
c9412d1
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24070/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24070/docs/index.html |
|
The build 228450 found UI Test snapshots differences: Details
|
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24070/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24070/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24070/wasm-skia-net9/index.html |
|
The build 229269 found UI Test snapshots differences: Details
|
|
|
|
The build 228693 found UI Test snapshots differences: Details
|
BC01 (#24070) landed on the base while this branch was in flight, adding two suites that host a bare ContentPresenter and read its ContentTemplateRoot. This branch makes that property private, so the merge broke every Build Samples App job with the same three CS1061. A standalone presenter has no ContentControl to report to, so these read the materialized root as the presenter's single visual child -- the same pattern already used by the ContentControl tests here. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
GitHub Issue: closes #18672
PR Type:
💬 Other... — breaking change (legacy API removal, no behavioural change intended)
What changed? 🚀
Uno carried two mechanisms for assigning a control's templated parent:
TemplatedParentScopepush/pop around template materialization, with the actualassignment happening in the
DependencyObjectStoreconstructor of everyDependencyObject.TemplateMaterializationSettingsthrough the generatedBuild/ApplyTomethods and assigns the templated parent explicitly.The new mechanism has been the live path for
XamlReader.Loadsince the Jan-2024 rework, but the codegenhalf was dormant behind
USE_NEW_TP_CODEGEN. This PR repairs the codegen path, makes it unconditional, andremoves the legacy mechanism outright — no
#if, no runtime toggle.Commits are ordered so each one builds clean and reviews independently:
refactor(xaml)#define+ both#ifs + the#else … = falsefallback all removed together); 13 generator goldens regeneratedfeat!TemplatedParentScopedeleted, along with theDependencyObjectStorector hook,ENABLE_LEGACY_TEMPLATED_PARENT_SUPPORT,ENABLE_LEGACY_DO_TP_SUPPORT, and the legacyFrameworkTemplateBuildersurfacerefactor!System.Func<…>behind a per-fileusingalias — no Uno-specific delegate type remainsfeat!Func<View?>factories are removed; 120 call sites portedfeat!internal, re-exposed viaMarkupHelper.Create{Data,Control,ItemsPanel}Template;XamlObjectBuilderde-reflectedfeat!DependencyObject.TemplatedParentDP is removed and its 5 readers repointedchorePackageDiffIgnore.xmlentries + BC01 ticked in the rollup specTwo side effects worth calling out as wins rather than incidental:
DependencyObjectStoreconstructor, i.e. onevery
DependencyObjectconstruction, to serve a case that only applies during template materialization.XamlObjectBuilderreached the template ctors viaActivator.CreateInstance, which is why three[DynamicDependency]attributes existed. Internalizing thectors let the call become a direct type switch, so the attributes were deleted rather than carried forward.
Breaking change: impact and migration
All removed API is Uno-only — none of it exists in WinUI, so no cross-platform compatibility is lost. In
each case WinUI's own surface is either unchanged or strictly closer after this PR.
new DataTemplate(() => view)(alsoControlTemplate,ItemsPanelTemplate)new DataTemplate(null, (_, _) => view)— orMarkupHelper.CreateDataTemplate(null, (_, _) => view)from outside the frameworkFrameworkTemplateBuilder,NewFrameworkTemplateBuilderdelegatesFunc<object?, TemplateMaterializationSettings, UIElement?>publicbuilder ctors on the four template typesUno.UI.Helpers.MarkupHelper.Create{Data,Control,ItemsPanel}Template(owner, factory). The parameterless ctors stay public, as in WinUIDependencyObject.TemplatedParent/TemplatedParentPropertyGetTemplatedParent(). The DP never had a working value —Inheritswas commented out and nothing wrote it, so every read returnednullTemplateManager.UpdateDataTemplate(DataTemplate, Func<View?>)Func<Builder?, Builder?>DependencyObjectStore.SetTemplatedParent(FrameworkElement?){ }no-op; delete the callThe
Func<View?>removal is the one with real reach (120 in-repo call sites). It is deliberate rather thanconvenient: that shape structurally cannot express a templated parent, whereas the surviving ctor hands the
factory its
TemplateMaterializationSettings, so an imperative template can now readsettings.TemplatedParent. Removing it converts a silent capability gap into a compile error with amechanical fix.
PR Checklist ✅
Screenshots Compare Test Runresults.Validation
Labelled per the repo's evidence protocol — what was compiled vs what was actually executed.
Runtime (executed, Skia Desktop / Win32, each A/B'd against a pre-change baseline):
Uno.UI.SourceGenerators.Tests)Uno.UI.UnitTestsCalendarfailures, byte-identical on baselineTemplatedParentTests,Given_FrameworkTemplate(Pool),Given_XamlReader_FrameworkTemplateComboBox,SplitView,MenuFlyout,ItemsControlFull Skia Desktop suite — executed, complete run: 8075 tests · 7844 passed · 51 failed · 180
inconclusive · 536 skipped, 46 secondary-window teardowns, zero crashes.
All 51 failures are accounted for, and none are caused by this PR:
AssemblyLoadContext— every one reportsAlcApp build failed with exit code 1; these tests shell out todotnet builda sub-app at runtime and that nested build is broken on this machineAppsUseLightTheme=0here, and e.g.Given_Window.When_RequestedTheme_Set_ExplicitlyassertsApplication.Current.RequestedTheme == Light, which only holds on a Light-mode host. Expected/actual are exact light↔dark counterparts (#E4000000↔#FFFFFFFF)DatePickerIntegrationTests— calendar/locale (same family as the 13 pre-existingCalendarunit-test failures)feature/breakingchangesworktree and identical there, down to the numbers:CommandBarFlyout_Leakrefcount 90 vs ≤13,When_Flyout_Closed_Target_Does_Not_Hold_Flyout,Given_TextBlock.When_Inlines_Transitively_Change,DragDrop_TreeView_Reorder_Automated [Mouse]The two leak failures were checked rather than assumed, since a templated-parent change is a plausible cause
of a flyout that will not collect. They reproduce in isolation and at baseline with byte-identical
assertion values. The generated code also cannot capture the settings:
ApplyTo_*is a class-level methodthat receives
__settingsas a parameter (GenericApply(__that, __nameScope, __settings, ApplyTo_X)), sono closure retains a templated parent.
The A/B baseline was verified to be the legacy path, not just a second build of the same tree:
SetTemplatedParentis absent from
Uno.UI.FluentTheme.v2.dllin the baseline and present in the branch build.Compile:
Uno.UI-Skia-only.slnfandSamplesApp.Skia.Generic.Rebased again onto
feature/breakingchangesat7c55431159, which foldedDependencyObjectStoreintoDependencyObject(BC26) and renamed every partial this PR touches. Three conflicts, all resolved by hand:DependencyObject.Store.cs— the legacy hook sat directly above upstream's new__InitializeBinder();only the
#ifblock was removed, the call kept.DependencyObject.csandDependencyObject.Store.cs— this PR's side still carried__Store-delegatingSetBinding/ResumeBindingsand the old~DependencyObjectStore()/Disposeshape, all supersededupstream. Dropped in favour of upstream's
SetBindingInternaland~DependencyObject().TemplatedParentScope.cs— modify/delete; deletion wins. All 7 upstream referencing files are ones this PRalready fixes.
ENABLE_LEGACY_DO_TP_SUPPORTsurvived the refactor with the same misleading name, still guarding the livetemplated-parent storage. Only the
#if/#endiflines were stripped; the four members stay.Two
PackageDiffIgnoreentries were removed as dead: BC26 added catch-allMicrosoft\.UI\.Xaml\.DependencyObjectStore.*regexes that subsume them, and upstream also madeSetTemplatedParentinternal, so its removal is no longer a public break.Re-validated on the rebased tree: goldens 480/0,
SamplesApp.Skia.Generic0/0, unit tests 13pre-existing failures (matching this base commit exactly, measured over 17 runs — see below), legacy-symbol
grep 0 hits.
Two
Given_CollectionViewSourcetests were observed failing once during this work(
When_Set_As_ItemsSource_And_Current_Initially_Setand its_With_Disabled_IsSynchronizedWithCurrentItemsibling). Measured rather than assumed:feature/breakingchanges@7c55431159TemplatedParent-DP-removal commitFisher's exact on 1/17 vs 0/11 is ≈1.0, so these samples cannot distinguish the two trees — they neither
implicate this PR nor establish the flake as pre-existing. The failure has only ever been reproduced on this
branch, never on
feature/breakingchanges, so I am explicitly not claiming it is pre-existing; the originis unattributed and worth a look. A
--filterdown to that class passes 16/16 every time, so it needs the full~4052-test run, and since
[assembly: DoNotParallelize]is set the nondeterminism is GC/finalizer timingrather than a thread race — which points at the pooled-array lifetime in
DependencyPropertyDetailsCollectionand
~DependencyObject()→BinderDispose(). Neither test carries[Ignore]/[GitHubWorkItem].Previously rebased onto
a6b66724f2(23 upstream commits, including the samples foldernesting, the PasswordBox reparent /
TextBoxCorerefactors, and the sync-gen parameter renames). The rebaseapplied with no conflicts, and the gates were re-run on the rebased tree:
Uno.UI.UnitTestsComboBox/SplitView/MenuFlyout/ItemsControlThe 8075-test full-suite run above was executed on the pre-rebase tree; post-rebase validation is the
targeted set in this table plus a clean
SamplesApp.Skia.Genericbuild. Full-suite coverage of the rebasedtree is this PR's CI run.
Given_FrameworkTemplate.InstancedLegacyFactory_ShouldNotLeakwas removed rather than ported: it exercisedthe
Func<View?>ctor, and itsInstancedFactory_ShouldNotLeaktwin already covers the surviving one. Thepooling/identity tests were rewritten by hand rather than mechanically ported, because the pool keys on
the factory's
Target/Method— converting a capturing closure into a static method group would havesilently changed pool identity and made the tests pass for the wrong reason.
Notes for reviewers
One item is open by nature of needing CI: the
PackageDiffIgnore.xmlentries are unverified against realtool output, because
generatepkgdiffneeds a packed nupkg across every TFM including mobile, which isn'tbuildable here. Entries use
isRegexwhere the tool's metadata form (parameter names, nullable annotations)can't be predicted. Unmatched entries are inert, so the failure mode is a red gate rather than a silent pass —
please check them against this PR's
ApiDiffreport.How the full local run was obtained (relevant to anyone reproducing it): the Win32 host segfaults with
0xC0000005inSkiaSharp.SKSurface.Dispose←SKNativeObject.Finalize()on secondary-window teardown —a pre-existing fault, reproduced at the unmodified base commit with a frame-for-frame identical stack, and
unrelated to this PR. The cause is a GPU-backed
SKSurfacefinalized after a window close destroyed itsGRContext, so forcing the raster renderer (FeatureConfiguration.Rendering.UseVulkanOnWin32 = falseplusUseOpenGLOnWin32 = false) sidesteps it entirely and no test had to be disabled. That switch was local and isnot part of this PR. Two consequences worth knowing: the host dying writes no results XML, so an aborted
run resembles a clean one; and the fault cannot be localized to a test class — it needs an abandoned GPU
surface and a GC at teardown, so a clean filtered run proves nothing. Since the run was software-rendered it
is not a like-for-like substitute for CI's GPU run, particularly for pixel comparisons.
Adjacent bug found while diagnosing that, not fixed here:
Win32WindowWrapper.Rendering.OpenGl.csreassigns
_layerwithout disposing the previous surface, while_swapchainSurfacegets a?.Dispose()twolines above — a leaked GPU surface of exactly the kind that produces this finalizer crash.
Also flagged deliberately:
nulltoday and now read a real templatedparent:
ComboBox.partial.mux.cs,SplitViewPaneAutomationPeer,SplitViewLightDismissAutomationPeer,ItemsControlAutomationPeer, andBrowserMediaPlayerPresenterExtension(this last one gates live WASMmedia behaviour). Each may fix a latent bug or surface new behaviour; the removal is what turned them
from silent nulls into compile errors.
TemplateManager.UpdateDataTemplatechanges signature, not just loses an overload. It is thedynamic-template-update entry point, so design-time tooling needs an aligned update.
LoadContentstill branches on the hardcoded-falsepublic
IsPoolingEnabled, soGiven_FrameworkTemplatePool.When_Recyclestays[Ignore]d (Template recycling for reworked Templated-Parent system #18317). Thisis a recorded choice, not a discovery — behaviour is unchanged, but the legacy mechanism no longer masks it.
src/SamplesApp/SimpleTestApp/is a scratch canary head, deliberately outsideInternalsVisibleTosoit proves the
MarkupHelperroute works from a consumer's position. It caught two errors every otherhead compiled through. It should be dropped before merge. It is also why this PR carries a
chore: apply XAML stylercommit:xaml-style-check.ymlgatessrc/SamplesApp/**/*.xamland fails the PRon drift, even though no solution builds that head.
🤖 Generated with Claude Code