Skip to content

refactor(media)!: DoubleCollection as composition (BC27) - #23740

Merged
Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc27-doublecollection-composition
Jul 20, 2026
Merged

Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc27-doublecollection-composition

Conversation

@Xiaoy312

Copy link
Copy Markdown
Contributor

GitHub Issue: #8339

PR Type:

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

What changed? 🚀

DoubleCollection was a Uno-only subclass of List<double>. WinUI's DoubleCollection is a sealed collection that implements IList<double> (and its bases) but is not a List<T> — it exposes none of List<double>'s extra surface (AddRange, Sort, Capacity, Reverse, BinarySearch, the non-generic IList/ICollection, IReadOnlyList<double>, …).

This PR (BC27 of the Phase 5 breaking-changes wave) reshapes DoubleCollection to composition over inheritance: it now wraps a private List<double> and implements IList<double> directly, matching WinUI's surface and mirroring the existing PointCollection pattern (minus change-notification, which DoubleCollection never had).

Preserved verbatim:

  • Both constructors — DoubleCollection() and DoubleCollection(IEnumerable<double>).
  • Both implicit conversion operators — from string ("1,2" / space-separated) and from double[].
  • The full IList<double> surface used by consumers: Count, indexer, Add, Insert, Remove, RemoveAt, Clear, Contains, IndexOf, CopyTo, IsReadOnly, and both GetEnumerator() overloads.

The only in-repo consumer that reads the collection contents is the Skia shape renderer (Shape.skia.cs, via Count + indexer); it and all StrokeDashArray usages continue to compile and run unchanged.

Validation:

  • Compile: SamplesApp.Skia.Generic (net10.0 Skia) builds clean, transitively compiling Uno.UI, Uno.UI.RuntimeTests, and all consuming samples.
  • Runtime: Given_XamlReader.When_DoubleCollection (exercises StrokeDashArray="1,2" string→collection population via XamlReader and XamlBindingHelper.ConvertValue) plus When_Shape StrokeDashArray rendering tests pass (Skia Desktop). Because behaviour is unchanged, these are pass-after regression guards, not fails-before repros.

No PackageDiffIgnore.xml entry is required — the package-diff gate tracks declared members only and does not track base-type changes; the declared-member set here only grows (the IList<double> members are now declared on the type instead of inherited from List<double>).

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample — N/A: not a behaviour change; existing Given_XamlReader / When_Shape tests exercise the population and render paths and were run as regression guards.
  • 📚 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): Code that relied on DoubleCollection being a List<double> no longer compiles — specifically calls to List<double>-only members (AddRange, Sort, Reverse, Capacity, BinarySearch, InsertRange, RemoveAll, …), or code that assigned/passed a DoubleCollection where a List<double>, non-generic IList/ICollection, or IReadOnlyList<double> was expected.
  • Migration: Work against the IList<double> surface. Replace AddRange(items) with a loop or new DoubleCollection(items); sort/reverse by materializing (col.ToList().Sort()) and rebuilding the collection. This aligns with WinUI, where DoubleCollection was never a List<T>.

@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on 2339b88

The Uno.WinAppSDKSyncGenerator produced changes that are not committed on this PR.

To apply automatically (PRs from branches in this repo only): comment /apply-sync-gen on this PR and a bot will push chore: Sync generator run to the head branch.

To apply manually (required for PRs from forks):

  1. Download the sync-generator-patch artifact from this run.
  2. In your local checkout of the PR branch:
    git apply sync-generator.patch
    git add -A
    git commit -m "chore: Sync generator run"
    git push
    

Or re-run the generator locally on Windows via build\run-api-sync-tool.cmd.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222084 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) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Examples.png-dark
    • Examples.png
    • Buttons.png-dark
    • Buttons.png
    • Gamepad_Enumeration.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • CompositionPath.png
    • DataTransferManager.png
    • DynamicFont.png-dark
    • DynamicFont.png
    • Image_AnimatedWebP.png-dark
    • Image_AnimatedWebP.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ColorPickerSample.png
  • skia-windows-screenshots: 82 changed over 2368

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

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc27-doublecollection-composition branch from 2339b88 to 911fa99 Compare July 16, 2026 14:58
@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on 911fa99

The Uno.WinAppSDKSyncGenerator produced changes that are not committed on this PR.

To apply automatically (PRs from branches in this repo only): comment /apply-sync-gen on this PR and a bot will push chore: Sync generator run to the head branch.

To apply manually (required for PRs from forks):

  1. Download the sync-generator-patch artifact from this run.
  2. In your local checkout of the PR branch:
    git apply sync-generator.patch
    git add -A
    git commit -m "chore: Sync generator run"
    git push
    

Or re-run the generator locally on Windows via build\run-api-sync-tool.cmd.

@unodevops

Copy link
Copy Markdown
Contributor

DoubleCollection was a Uno-only subclass of List<double>. WinUI's
DoubleCollection implements IList<double> but is not a List<T>. Reshape
it to wrap a private List<double> and implement IList<double> directly,
mirroring PointCollection (minus change-notification). Both constructors
and both implicit operators (string, double[]) are preserved.

BC27 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/bc27-doublecollection-composition branch from 911fa99 to 1447e37 Compare July 16, 2026 16:16
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222683 found UI Test snapshots differences: skia-linux-screenshots: 67, skia-windows-screenshots: 98

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

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

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DisplayInformation.png-dark
    • Image_AnimatedWebP.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • ImageBrushAlignmentXY.png
    • ColorPickerSample.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • CalendarView_Theming.png-dark
    • ImagesInlineInFlipView.png-dark
    • ImagesInlineInFlipView.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png

@unodevops

Copy link
Copy Markdown
Contributor

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

@Xiaoy312
Xiaoy312 enabled auto-merge July 18, 2026 00:18
@Xiaoy312
Xiaoy312 merged commit 3ede17f into feature/breakingchanges Jul 20, 2026
49 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20260713/bc27-doublecollection-composition branch July 20, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants