Repository navigation
Update ItemsRepeater - #23406
Update ItemsRepeater#23406
ItemsRepeater#23406Conversation
WinAppSDK sync generator drift detected on
|
|
/apply-sync-gen |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23406/wasm-skia-net9/index.html |
|
Pushed GitHub does not re-trigger workflows for commits pushed by the default bot, so the WinAppSDK Sync Generator Check will not automatically re-run. To turn it green, push any additional commit (for example |
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23406/wasm-skia-net9/index.html |
f118e25 to
8f48825
Compare
|
Claude finished @MartinZikmund's task in 8m 2s —— View job PR Review: Update
|
| # | Severity | File | Summary |
|---|---|---|---|
| 1 | 🔴 High | ViewManager.mux.cs:25 |
m_lastFocusedElement = owner incorrectly translates a tracker_ref host-registration ctor; field should be null |
| 2 | 🔴 High | ViewManager.mux.cs:27-28 |
Eager ElementFactoryGetArgs/ElementFactoryRecycleArgs allocation makes downstream null guards dead code; matches another tracker_ref mistranslation |
| 3 | 🟡 Medium | RecyclingElementFactory.mux.cs:98 |
m_templates.First().Key boxes a struct enumerator on every element realization (hot path) |
| 4 | 🟡 Medium | Diff/StructuralDiff.md et al. |
22 generated analysis docs (~6 300 lines) committed under the production source tree — consider doc/ or a GitHub issue for the confirmed bugs |
| 5 | 🔵 Low | NonVirtualizingLayout.mux.cs:46,56 |
Pure-virtual C++ methods ported as virtual … throw NotImplementedException() rather than abstract |
Cross-cutting notes
- Events: no
event Action<T>— all events correctly useTypedEventHandler<T,U>. ✅ - Async discipline: no
.Result/.GetAwaiter().GetResult(), no unguardedasync void. ✅ - DependencyProperties:
FlowLayout.Properties.csandRecyclePool.Properties.csuse the correctFrameworkPropertyMetadatapattern withnameof-equivalent strings. TheEnsureProperties()lazy-init factory matches WinUI C++ intent. ✅ - Platform targeting:
.mux.cs/.uno.cs/.h.mux.cssuffixes are used correctly;#if !__SKIA__guards are appropriate. ✅ #pragma warning disableusage: all suppressions are narrowly scoped with explanatory comments. ✅- Tests: The new runtime tests (
ViewManagerTests,LayoutTests,FlowLayoutTests, etc.) follow the[RunsOnUIThread]/async Taskconventions. The[Ignore]onCanQueryElementFactoryretains the existing issue link. ✅ - Diff files as bug trackers:
_DistilledDiffViewManagement.mddocuments three confirmed behavioral bugs (Setting Image.Source to local image (added as "Content" to Assets/ folder in UWP project) leads to WASM app never going past the Splashscreen #1 and Paths are either not shown or shown not as in the UWP Designer #2 above plus theCoreDispatcher.RunIdleAsync→DispatcherQueue.TryEnqueuedivergence). The first two are present in this PR's code and should be fixed here or tracked as issues before merge.
Validation note
Assessment is code-review only (diff inspection + file reads). Findings #1 and #2 are confirmed by cross-checking the Uno code against the WinUI C++ behavior described in both the committed Diff files and the WinUI source. Runtime validation would require running the ViewManagerTests suite.
|
Claude finished @MartinZikmund's task in 2m 35s —— View job PR Review: Update
|
| # | Severity | Status | Summary |
|---|---|---|---|
| 1 | 🔴 High | ✅ Fixed | m_lastFocusedElement now starts null (was seeded with owner) |
| 2 | 🔴 High | ✅ Fixed | ElementFactoryGetArgs/RecycleArgs now lazily allocated by the existing null guards |
| 3 | 🟡 Medium | m_templates.First().Key struct-enumerator boxing on hot path — inline comment posted |
|
| 4 | 🔵 Low | 22 Diff/ markdown files still committed under production source tree |
|
| 5 | 🔵 Low | ✅ Addressed | virtual throw NotImplementedException() now has an explanatory comment documenting WinUI composable-runtimeclass intent |
Cross-cutting notes (no new issues found)
- Events: no
event Action<T>— all useTypedEventHandler. ✅ - Async discipline: no
.Result/.GetAwaiter().GetResult(), no unguardedasync void. ✅ - VirtualizationInfo:
MustClearDataContextandIsInPinnedPoolcorrectly present per PR description. ✅ - Layout.h.mux.cs:
CreateDefaultItemTransitionProvidercorrectly widened toprotected internal. ✅ - BuildTreeScheduler:
[ThreadStatic]fields correctly lazy-initialized on first use (can't use inline initializers). ✅ - Tests: new
ViewManagerTests,FlowLayoutTests,LayoutTests,ItemTemplateTestsfollow[RunsOnUIThread]/async Taskconventions. ✅
Validation note
Assessment is code-review only (diff inspection + file reads). Findings #1 and #2 are confirmed fixed by cross-checking the corrected constructor against the previous diff. Runtime validation requires running the ViewManagerTests suite.
Review comments addressed — commit
|
| file:line | reviewer point | what changed |
|---|---|---|
ViewManager.mux.cs:25 |
m_lastFocusedElement = owner mistranslates tracker_ref<T>(ITrackerHandleManager*) — the field should start null |
Correct — removed. Confirmed against ViewManager.h:88 (tracker_ref<winrt::UIElement> m_lastFocusedElement) and ViewManager.cpp:14: the ctor-initialiser registers the tracker host, it does not seed a value. All 5 read sites are null-safe (== element, is Control, != null), so null is the correct seed. Beyond the two consequences you listed, the seeding also made the first focus change call UpdatePin(m_lastFocusedElement /* the repeater itself */, addPin: false) at line ~945. |
ViewManager.mux.cs:27-28 |
m_ElementFactoryGetArgs / m_ElementFactoryRecycleArgs eagerly allocated; makes the downstream lazy-create guards dead code |
Correct — removed. Same tracker_ref host-registration overload (ViewManager.h:99-100); WinUI lazily creates them at ViewManager.cpp:171-174 / 772-774. The C# guards at lines 160-163 and 730-732 already do the lazy create, so removing the eager allocation restores WinUI behaviour without an NRE risk. |
A short comment now records why those three fields are left unassigned, so the next reader doesn't "fix" it back.
No change needed (2)
| file:line | the point | why no change |
|---|---|---|
RecyclingElementFactory.mux.cs:98 |
m_templates.First().Key boxes the dictionary enumerator; use a foreach over templates.Keys helper instead |
The allocation is real, but the proposed fix does not remove it. m_templates is declared as the interface IDictionary<string, DataTemplate> (RecyclingElementFactory.h.mux.cs:12 — it's the WinRT IMap<hstring, DataTemplate> projection, and Templates is a public settable property, so the concrete type is user-supplied). Through that interface, .Keys is an ICollection<string>, so foreach dispatches IEnumerable<string>.GetEnumerator() and boxes KeyCollection.Enumerator exactly like First() does. The claim "foreach over Dictionary<K,V>.Keys uses the struct enumerator without boxing" only holds when the static type is the concrete Dictionary<K,V>, which it isn't here. Removing the box would need a is Dictionary<,> type test — a deviation from the 1:1 port of m_templates.get().First().Current().Key() for one ~40-byte box on a path that also runs DataTemplate.LoadContent() (a whole subtree realization). Not worth the parity cost. |
NonVirtualizingLayout.mux.cs:46 |
virtual + throw new NotImplementedException() should be abstract to "match the C++ pure-virtual intent" |
The premise is incorrect: WinUI does not declare these pure-virtual. NonVirtualizingLayout.h:19-20 declares plain virtual methods and NonVirtualizingLayout.cpp:29-37 gives them throwing bodies (throw winrt::hresult_not_implemented()) — which is precisely what this port does. NonVirtualizingLayout is also a public, instantiable, composable runtimeclass with a public constructor; making it abstract would be a public API break against both WinUI and Uno's own surface. Left as-is, and (per your suggestion) added a comment explaining why for future maintainers. |
Needs @MartinZikmund input (1) — left open
| file:line | the point | why it needs you |
|---|---|---|
Repeater/Diff/*.md (22 files, ~6 300 lines) |
Should the generated parity-analysis markdown live permanently under src/Uno.UI/…/Repeater/? Suggests moving to doc//specs/ or dropping them. |
Legitimate repo-hygiene concern, but the disposition is a judgment call only you can make: keep as long-lived parity docs (and if so, where), or treat them as one-time PR artifacts and delete. Deleting or relocating 22 files is destructive and this is a pending/ branch where the analysis may still be driving the port work, so I did not guess. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23406/wasm-skia-net9/index.html |
f240682 to
07e6e6c
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23406/wasm-skia-net9/index.html |
|
Claude finished @MartinZikmund's task in 3m 10s —— View job PR Review: Update
|
| # | Severity | Status | Summary |
|---|---|---|---|
| 1 | 🔴 High | ✅ Fixed | m_lastFocusedElement now starts null; comment at lines 25-27 explains the tracker_ref host-registration pattern |
| 2 | 🔴 High | ✅ Fixed | ElementFactoryGetArgs/RecycleArgs now lazily allocated by the existing null guards; confirmed by reading ViewManager.mux.cs:18-29 |
| 3 | 🟡 Medium | ✅ Accepted (no change needed) | m_templates.First().Key boxing: MartinZikmund's counter-argument is correct — m_templates is typed as IDictionary<string, DataTemplate> (interface), so foreach over .Keys dispatches ICollection<string>.GetEnumerator() and boxes identically. The proposed fix doesn't remove the allocation. |
| 4 | 🔵 Low | 22 Diff/ markdown files (~6 300 lines) under src/Uno.UI/…/Repeater/Diff/ — disposition is author's call (keep in place, move to doc//specs/, or delete as one-time artifacts) |
|
| 5 | 🔵 Low | ✅ Fixed | NonVirtualizingLayout.mux.cs — comment added at lines 45-46 explaining WinUI composable-runtimeclass intent and why virtual rather than abstract |
Cross-cutting checks on new commits
- IDE0051 suppressions (
db8d0dad): all are narrowly scoped with#pragma warning disable/restorepairs and carry explanatory comments per code-style rules. ✅ - Commentary trim (
1a346348): removes verbose "Uno specific" notes for natural C# idioms; no behavior change. ✅ SerialDisposablerevokers (649099c3):m_gotFocus/m_lostFocuscorrectly useSerialDisposableto replicate WinUI'sauto_revoketoken pattern. ✅ItemsSourceViewMove decomposition (2a3e0f1d): INCC Move → Remove+Add bridge correctly placed atItemsSourceView.Impl.cs:192-197so the ported WinUI control code never sees the unsupportedMoveaction. ✅- Events: no
event Action<T>— all useTypedEventHandler/EventHandler. ✅ - Async discipline: no
.Result/.GetAwaiter().GetResult(), no unguardedasync void. ✅
Validation note
Assessment is code-review only (diff inspection + file reads). The two high-severity findings are confirmed fixed by reading the current ViewManager.mux.cs:18-29. Runtime validation requires running the ViewManagerTests suite — use /runtime-tests ViewManagerTests on Skia Desktop.
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23406/docs/index.html |
07e6e6c to
7d87d09
Compare
|
Claude finished @MartinZikmund's task in 4m 30s —— View job PR Review: Update
|
| # | Severity | File | Summary |
|---|---|---|---|
| 1 | 🟡 Medium | FlowLayoutAlgorithm.mux.cs:765 |
countInLine * 2 — integer multiply in float divide expression; use 2f |
| 2 | 🟡 Medium | FlowLayoutAlgorithm.mux.cs:767 |
(... + 1) * 2 - 1 — all-int sub-expression; use 2f |
| 3 | 🟡 Medium | ItemTemplateTests.cs:356 |
itemBorder.Child accessed without null-guarding itemBorder (real NRE risk) |
| 4 | 🔵 Low | LayoutTests.cs:160,179 |
CodeQL: Verify.IsNotNull not recognised as a null-terminator; add if (child is null) { return; } |
| 5 | 🔵 Low | LayoutTests.cs:172-173 |
CodeQL: int * int widened to double; use 10.0 / 100.0 |
| 6 | 🔵 Low | ItemTemplateTests.cs:364 |
CodeQL: follow-on from #3; resolved by fixing #3 |
Findings #1 and #2 are one-character fixes (2 → 2f). Finding #3 is a real null-dereference path in the test when the realized element is not a Border.
Status of prior findings
All high-severity findings from previous review passes remain resolved (✅). No regressions introduced by the latest commit.
Validation note
Assessment is code-review only (diff inspection + file reads). Runtime validation for the production-code changes requires running /runtime-tests FlowLayoutTests on Skia Desktop.
Picks up the WinUI 2.5.1 servicing fix (WinAppSDK 62786355) for FlowLayout and UniformGridLayout: a collection change can reach a layout that is not, or is no longer, initialized for the context -- such as the reset ItemsRepeater sends while unloading -- and dereferencing the null state faults. StackLayout already guarded this; the other two now mirror it. Point the MUX Reference lines of the files whose upstream counterpart moved between 1.8.2 and 2.5.1 at the 2.5.1 tag, so the next sync diffs from the revision the C# actually carries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
When_UnloadReload_Then_MaterializeItemsForCurrentViewport was disabled for a Uno-specific extent clamp, but it failed on item presence long before that assertion: the stale effective viewport wiped the realization window on reload. With the viewport fix it passes end to end, offset assertion included. When_WheelScrollDownThroughVarianceList_Then_OffsetMonotonicallyAdvances goes back to its platform Ignore conditions -- it was the same collapsed viewport moving the offset backward mid-wheel. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
Every other helper in the Repeater test Common folder carries it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
ValidateDataTemplateWithElementNameBinding and its nested variant cover uno#24477, an Uno gap in resolving ElementName across a DataTemplate loaded through XamlReader.Load. Gate the Ignore on HAS_UNO so the WinAppSDK leg, where the binding resolves, keeps the coverage. The two RecyclePool leak tests stay unconditional on purpose, and now say so: they cover a fix WinUI shipped in 2.5.1 while SamplesApp builds against WindowsAppSDK 2.4.0, so the WinUI leg does not pass them either. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
WinUI computes the layout origin as firstRealizedLayoutBounds.MajorStart minus firstRealizedItemIndex * averageElementSize. averageElementSize is a running mean over the realized items, so the origin drifts by a few pixels whenever a tall item enters or leaves the realization buffer. WinUI absorbs that drift through the viewport shift the repeater hands its scroller; Uno's ScrollViewer does not consume ItemsRepeater's pending viewport shift, so it lands on screen instead -- items change their repeater-local Y between two wheel ticks, and a shrinking estimate drags the offset backward mid-gesture. master carried a workaround for this and the port dropped it for parity, which regressed both wheel guards on every Skia head. With the runner's three attempts they only looked flaky; at one attempt they fail on the first iteration. Restore it as an Uno-specific hook so the ported GetExtent keeps the WinUI formula in plain sight and the deviation stays in StackLayout.uno.cs, with the reason and the condition for removing it written down. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
Out of the ported header and into StackLayoutState.uno.cs, so the .h.mux.cs stays 1:1 with WinUI, and renamed to the _camelCase the other Uno-only fields in this folder use. Also widened to double. Everything it is compared against or assigned from -- MajorStart, SetMajorStart, Rect -- is double, so holding it as float truncated on the way in and out, and the sub-pixel drift that leaked into the itemsAboveHeld comparison is the very thing this mechanism exists to avoid. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
Defensive hardening, not a proven bug fix. The held origin is derived from the content that produced it, and OnElementSizesReset already exists to clear the per-content state on a collection Reset or a rasterization-scale change, so leaving this field out of it lets an origin outlive its content. I could not build a runtime test that fails without this line: two shapes were tried, reassigning ItemsSource while scrolled with equal-sized items and with items five times shorter, and both pass either way because the post-reset anchor releases the held origin on its own. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
When_ItemSignificantlyTaller_Then_VirtualizeProperly was disabled for the same removed extent clamping as the two wheel guards. It passes now that the held layout origin is back. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HiJR8QDtVzGWTouX6ui79N
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JmAZS9BxRFEsNrmB3tQKGU
a7e08a7 to
4a67e6a
Compare
|
Claude finished @MartinZikmund's task in 1m 14s —— View job PR Review: Update
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23406/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23406/docs/index.html |
|
The build 236183 found UI Test snapshots differences: Details
|
|
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. |
FlowLayout.idl only has LineSpacing and MinItemSpacing. The MinColumnSpacing/MinRowSpacing pair was removed on purpose by the ItemsRepeater sync (#23406); the samples and tests that set them use UniformGridLayout, which keeps its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011swjKyeQhuwHxAJW5R1vk8
GitHub Issue: closes #22906, closes #22907, closes #22908, closes #24447, closes #23624, closes #21668
PR Type:
💬 Other... — WinUI source sync: refactoring, bug fixes, and public-API alignment (includes removals)
What changed? 🚀
Syncs
ItemsRepeaterand its layouts with the current WinUI C++ sources, splitting each type into the.h.mux.cs/.mux.cs/.uno.cslayout the porting rules expect. This covers the three tracking sub-issues:ItemsRepeater+ViewportManager(incl. theDownlevelvariant) +ViewManagerstructural syncFlowLayoutAlgorithm,ElementManager,StackLayout,FlowLayout,UniformGridLayoutSelectionModel/SelectionNode/SelectionTreeHelper, automation peer,Phaser,BuildTreeScheduler,RecyclePool,RecyclingElementFactory,VirtualizationInfo,CustomProperty,ItemsRepeaterScrollHostLinedFlowLayout(#22909) is not in scope here and remains stubbed.Reported bugs this fixes
Each is covered by a runtime test in
Given_ItemsRepeater, verified on Skia Desktop to fail onmasterand pass here:ItemsRepeaters sharing aUniformGridLayoutitem template never completed their first layout (LayoutCycleExceptionon every tick, app stuck on the splash screen).UniformGridLayoutState.EnsureElementSizeforce-created and recycled item 0 on every measure while no viewport was known, and the per-DataTemplateRecyclePoolre-parented that element between the two repeaters, re-dirtying measure each pass. Fixed by porting WinUI'sm_isEffectiveSizeValidguard and the matchingArrangeOverridereset.DataContext. Fixed byVirtualizationInfo.MustClearDataContext, so the clear happens only when the repeater was the one that set it.ItemsRepeaterdisposes #21668 — clearingItemsSourceafter an unload/reload cycle faulted in the data-source subscription revoker re-installed on the secondLoaded.API surface
Uno-only members that WinUI never projects were reduced to
internalor removed (FlowLayoutAlgorithm,IFlowLayoutAlgorithmDelegates,ItemsRepeater.GetElementImpl/ClearElementImpl,StackLayout.Algorithm_OnLineArranged, andFlowLayout.MinColumnSpacing/MinRowSpacing, which are absent fromFlowLayout.idl). Corresponding entries were added to the6.7set inbuild/PackageDiffIgnore.xml.Known regressions to resolve before merge
Removing the Uno-specific
firstRealizedMajorclamping inStackLayout.GetExtentfor parity re-exposes viewport realization gaps that the clamp was compensating for:ItemsRepeaterfails to layout items when navigated back again #11626 regressed — after an unload/reload (or navigating back to a cached page) and scrolling, only the first two items of the visible window are realized. Deterministic on Skia Desktop: 6/6 runs fail here, 6/6 pass onmaster.When_ItemSignificantlyTaller_Then_VirtualizeProperlyandWhen_UnloadReload_Then_MaterializeItemsForCurrentViewportare[Ignore]d for the same reason.Given_ItemsRepeater_FastScroll.When_WheelScrollDownThroughVarianceList_Then_OffsetMonotonicallyAdvances(uno#23041) is disabled: it fails here and passes onmaster. It is an Uno-only guard —NotExecutedon the WinAppSDK leg, which has noInputInjector.PR Checklist ✅
Screenshots Compare Test Runresults.Breaking changes: the public members listed under API surface are removed or reduced to
internalto match the WinUI surface.FlowLayout.MinColumnSpacing/MinRowSpacingare the only ones likely to appear in app code;UniformGridLayoutcarries the equivalent properties.