Skip to content

refactor(xaml)!: Drop Uno-only IEnumerable on FE/CC (BC65) - #23744

Merged
Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc65-drop-uno-ienumerable
Jul 31, 2026
Merged

Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc65-drop-uno-ienumerable

Conversation

@Xiaoy312

Copy link
Copy Markdown
Contributor

GitHub Issue: #8339

PR Type:

💬 Other... Breaking change (API alignment with WinUI)

What changed? 🚀

FrameworkElement and ContentControl implemented System.Collections.IEnumerable in Uno — a Uno-only divergence WinUI does not have. On FrameworkElement it was paired with public Add(...) methods on Border, Panel, and ScrollViewer to enable C#-markup collection-initializer syntax (new StackPanel { child1, child2 }, new Border { child }). WinUI has neither the interface nor those Add methods.

This PR (BC65 of the Phase 5 breaking-changes wave) removes the whole Uno-only surface for WinUI parity (ground rule #2 — remove divergences, don't preserve intermediate Uno-only shapes):

  • FrameworkElement — dropped : IEnumerable (FrameworkElement.crossruntime.cs, .skia.cs, .reference.cs) and the public IEnumerator GetEnumerator() (.skia.cs, .reference.cs).
  • ContentControl — dropped the redundant : IEnumerable re-declaration (it had no own GetEnumerator; it inherited FrameworkElement's).
  • Border / Panel / ScrollViewer — removed the now-orphaned public Add(UIElement) collection-initializer helpers (they only had meaning together with the IEnumerable).

Migration

Collection-initializer child syntax moves to the explicit content/children property:

Before After
new StackPanel { a, b } new StackPanel { Children = { a, b } }
new Border { child } new Border { Child = child }
new ScrollViewer { content } new ScrollViewer { Content = content }

All 14 in-repo call sites (in Uno.UI.RuntimeTests) were migrated accordingly. foreach/LINQ over a FrameworkElement's visual children (which the IEnumerable also allowed) should use VisualTreeHelper or the control's own children collection instead.

Validation:

  • Compile (Skia RID = desktop + Skia-on-WASM): SamplesApp.Skia.Generic (net10.0) builds clean, transitively compiling Uno.UI, Uno.UI.RuntimeTests, and all samples — 0 warnings / 0 errors. SamplesApp had no bare-collection-init usages. Framework build surfaced no direct .Add() callers.
  • Native/WASM: the native-WASM-DOM sample app no longer exists (the live WASM head is Skia-on-WASM, covered above); a sweep of all .Android.cs / .iOS.cs / .UIKit.cs / .wasm.cs / .reference.cs files found no element .Add() callers or bare-collection-init, so native heads keep compiling.
  • Runtime (Skia Desktop): 33/33 pass across Given_ThemeResource (15), Given_FrameworkElement_ThemeResources, Given_ContentControl, plus the migrated Given_UIElement/Given_UnoFocusInputHandler cases. This specifically guards the EnterProperties/LeaveProperties namescope/theme walk: a detached FrameworkElement set as a property value used to also match is IEnumerable there and have its visual children iterated — an accidental divergence from the WinUI code being ported (WinUI's FrameworkElement isn't IEnumerable, so that branch only ever handled genuine DO-collections). Removal aligns Uno with WinUI; theme/namescope propagation is unchanged (children still enter via the visual walk on activation).

PackageDiffIgnore.xml (6.5 baseline) gets two entries for the removed declared members: FrameworkElement.GetEnumerator() and the Border/Panel/ScrollViewer Add(UIElement) methods. The interface-list change itself isn't tracked by the gate.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample — N/A: not a behaviour change; existing theme/content/namescope tests exercise the affected Enter/Leave path and were run as regression guards, and the 14 migrated tests confirm the markup change is behaviour-preserving.
  • 📚 Docs have been added/updated — N/A (migration note below).
  • 🖼️ Validated PR Screenshots Compare Test Run results — N/A (no visual change).
  • ❗ Contains NO breaking changes — intentionally left unchecked; this is a breaking change (see below).
  • 👀 Reviewed 2 other open pull requests

Breaking change — impact & migration path

  • Impact (source-breaking): FrameworkElement/ContentControl no longer implement IEnumerable. C#-markup collection-initializer child syntax (new Panel { child }, new Border { child }, new ScrollViewer { content }) no longer compiles, and the public Add(UIElement) helpers on Border/Panel/ScrollViewer are gone. foreach/LINQ directly over a FrameworkElement no longer compiles.
  • Migration: Use the explicit content property in initializers — Children = { … } for panels, Child = … for Border, Content = … for ScrollViewer (see the table above). For enumerating children, use VisualTreeHelper or the panel's Children. This matches WinUI, whose FrameworkElement/ContentControl were never IEnumerable.

@github-actions github-actions Bot added area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation labels Jul 13, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222094 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 82

Details
  • skia-linux-screenshots: 73 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Basics Pivot Test.png
    • CalendarView_Theming.png
    • ColorPickerSample.png
    • Buttons.png
    • CalendarView_Theming.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • EllipsemaskingEllipseGrid.png
    • DynamicFont.png-dark
    • DynamicFont.png
    • Gamepad_Enumeration.png-dark
    • Image_AnimatedWebP.png-dark
    • Image_AnimatedWebP.png
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Examples.png-dark
    • Examples.png
    • CompositionPath.png
    • DoubleImageBrushInList.png-dark
    • Gamepad_CurrentReading.png-dark
  • skia-windows-screenshots: 82 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CompositionPath.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Buttons.png-dark
    • Buttons.png
    • Image_AnimatedWebP.png
    • ClipboardTests.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_Enumeration.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Image_UseTargetSize.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DoubleImageBrushInList.png-dark
    • DisplayInformation.png-dark

@Xiaoy312
Xiaoy312 enabled auto-merge July 16, 2026 15:03
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc65-drop-uno-ienumerable branch from 019f395 to 5b61cf9 Compare July 16, 2026 15:03
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222663 found UI Test snapshots differences: skia-linux-screenshots: 67, skia-windows-screenshots: 94

Details
  • skia-linux-screenshots: 67 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • BitmapIcon_Foreground.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ClipboardTests.png-dark
    • DataTransferManager.png
    • Image_Margin_Large.png-dark
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • EllipsemaskingEllipseGrid.png
    • Gamepad_Enumeration.png-dark
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png
    • DynamicFont.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • ImageIconPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • ImageIconPage.png
  • skia-windows-screenshots: 94 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DisplayInformation.png-dark
    • ImageBrushAlignmentXY.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • ImageBrushLocalAsset.png-dark
    • ImageBrushLocalAsset.png
    • CalendarView_Theming.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DynamicFont.png
    • Gamepad_Enumeration.png-dark
    • DropDownButtonPage.png
    • Buttons.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc65-drop-uno-ienumerable branch from 5b61cf9 to a5d02b6 Compare July 22, 2026 14:36
@Xiaoy312 Xiaoy312 added the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label Jul 22, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc65-drop-uno-ienumerable branch from a5d02b6 to 02d8ef9 Compare July 22, 2026 18:33
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 223668 found UI Test snapshots differences: skia-linux-screenshots: 67, skia-windows-screenshots: 94

Details
  • skia-linux-screenshots: 67 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DisplayInformation.png-dark
    • BitmapIcon_Foreground.png
    • Examples.png-dark
    • Examples.png
    • Gamepad_Enumeration.png-dark
    • ElementLevelTheme.png-dark
    • ButtonClippingTestsControl.png-dark
    • DynamicFont.png
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrush_Stretch.png-dark
    • Image_Margin_Large.png-dark
    • DataTransferManager.png
    • EllipsemaskingEllipseGrid.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Gamepad_CurrentReading.png-dark
  • skia-windows-screenshots: 94 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gamepad_Enumeration.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Image_AnimatedWebP.png-dark
    • ContentPresenter_NativeEmbedding_ZIndex.png
    • Gamepad_CurrentReading.png-dark
    • ImageIconPage.png-dark
    • Buttons.png-dark
    • Buttons.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 223668 has failed on Uno.UI - CI.

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc65-drop-uno-ienumerable branch from 02d8ef9 to aa1d623 Compare July 27, 2026 19:24
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 224358 found UI Test snapshots differences: skia-linux-screenshots: 67, skia-windows-screenshots: 99

Details
  • skia-linux-screenshots: 67 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DynamicFont.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Image_Margin_Large.png-dark
    • BitmapIcon_Foreground.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ElementLevelTheme.png-dark
    • DataTransferManager.png
    • DisplayInformation.png-dark
    • Gamepad_CurrentReading.png-dark
    • EllipsemaskingEllipseGrid.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Image_AnimatedWebP.png
    • ButtonClippingTestsControl.png-dark
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png
  • skia-windows-screenshots: 99 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png
    • Gamepad_Enumeration.png-dark
    • ButtonClippingTestsControl.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • Image_UseTargetSize.png-dark
    • ImageIconPage.png-dark
    • DropDownButtonPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ComboBox_ItemDataContext.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • DisplayInformation.png-dark

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 224358 has failed on Uno.UI - CI.

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc65-drop-uno-ienumerable branch from aa1d623 to 4de8e8d Compare July 28, 2026 07:16
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 224474 found UI Test snapshots differences: skia-linux-screenshots: 67, skia-windows-screenshots: 93

Details
  • skia-linux-screenshots: 67 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DynamicFont.png
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Image_AnimatedWebP.png
    • BitmapIcon_Foreground.png
    • ElementLevelTheme.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • Examples.png-dark
    • Examples.png
    • ImageBrush_Stretch.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • EllipsemaskingEllipseGrid.png
  • skia-windows-screenshots: 93 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_Enumeration.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Image_UseTargetSize.png-dark

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc65-drop-uno-ienumerable branch from 4de8e8d to 559bd86 Compare July 29, 2026 14:14
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 224749 found UI Test snapshots differences: skia-linux-screenshots: 88, skia-windows-screenshots: 90

Details
  • skia-linux-screenshots: 88 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • EllipsemaskingEllipseGrid.png
    • ImageSourceUrlMsAppDataScheme.png
    • ColorPickerSample.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ImageBrushInList.png-dark
    • CalendarView_Theming.png-dark
    • ImageBrushInList.png
    • CalendarView_Theming.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Image_Margin_Large.png-dark
  • skia-windows-screenshots: 90 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ContextRequested.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • Gamepad_CurrentReading.png-dark
    • ImageBrushAlignmentXY.png
    • Gamepad_Enumeration.png-dark

FrameworkElement and ContentControl implemented System.Collections.
IEnumerable, a Uno-only divergence WinUI does not have. On FrameworkElement
it paired with public Add(UIElement) helpers on Border/Panel/ScrollViewer to
enable C#-markup collection-initializer syntax (new Panel { child }). WinUI
has neither.

Remove the whole surface for parity:
- FrameworkElement: drop : IEnumerable and GetEnumerator (crossruntime/skia/
  reference).
- ContentControl: drop the redundant : IEnumerable re-declaration (it
  inherited FrameworkElement's GetEnumerator).
- Border/Panel/ScrollViewer: remove the now-orphaned public Add(UIElement).

Migrate initializers to the explicit property: Children = { } for panels,
Child = for Border, Content = for ScrollViewer (14 sites in RuntimeTests).
PackageDiffIgnore (6.5) gets entries for the removed GetEnumerator and Add.

BC65 of the 7.0 breaking-changes rollup (#8339).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc65-drop-uno-ienumerable branch from 559bd86 to d682151 Compare July 29, 2026 20:09
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 224858 found UI Test snapshots differences: skia-linux-screenshots: 88, skia-windows-screenshots: 88

Details
  • skia-linux-screenshots: 88 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • EllipsemaskingEllipseGrid.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ImageSourceUrlMsAppDataScheme.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Examples.png
    • Image_Margin_Large.png-dark
    • Basics Pivot Test.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
  • skia-windows-screenshots: 88 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DropDownButtonPage.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ContextRequested.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Gamepad_Enumeration.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Gamepad_CurrentReading.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Buttons.png-dark
    • Buttons.png
    • ContentPresenter_NativeEmbedding_ZIndex.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DisplayInformation.png-dark
    • DisplayInformation.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 224858 has failed on Uno.UI - CI.

@Xiaoy312
Xiaoy312 merged commit 754ce99 into feature/breakingchanges Jul 31, 2026
68 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20260713/bc65-drop-uno-ienumerable branch July 31, 2026 07:49
MartinZikmund pushed a commit that referenced this pull request Oct 14, 2026
…uide

#23744 (BC65) removed the Uno-only IEnumerable implementation from
FrameworkElement and ContentControl, and the Add helpers on Border, Panel
and ScrollViewer, so C# collection initializers on those types no longer
compile. Add a section with the replacements and extend the matching
checklist step.

Fixes #25329
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants