Skip to content

fix: Widen members to public for WinUI API parity - #23668

Merged
MartinZikmund merged 2 commits into
feature/breakingchangesfrom
dev/mazi/publicprotected
Jul 8, 2026
Merged

MartinZikmund merged 2 commits into
feature/breakingchangesfrom
dev/mazi/publicprotected

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes unoplatform/uno-private#2201

PR Type:

🐞 Bugfix

What changed? 🚀

Some Microsoft.UI.Xaml.* / Windows.* members were declared narrower than the WinAppSDK reference surface — the same class of defect as #23653 (Hyperlink.UnderlineStyleProperty was internal while its CLR wrapper was public), which silently blocks external use (binding, ClearValue, styles, animations, construction, direct reads) even though the containing type is public.

The entire Uno WinRT-facing surface was audited (see method below); 8 genuine narrowings were found and fixed:

Uno.UI (Microsoft.UI.Xaml.*)

Member Change
ItemsRepeaterScrollHost.HorizontalAnchorRatio internal → public
ItemsRepeaterScrollHost.VerticalAnchorRatio internal → public
RepeatedScrollSnapPoint.Start private → public
RepeatedScrollSnapPoint.End private → public
ItemsSourceView.IndexOf(object) internal → public

Uno.UWP (Windows.Graphics.*)

Member Change
PointInt32(int, int) ctor internal → public
RectInt32(int, int, int, int) ctor internal → public
SizeInt32(int, int) ctor internal → public

In every case the sibling members were already public (Offset/Interval on RepeatedScrollSnapPoint; GetAt/IndexFromKey/KeyFromIndex on ItemsSourceView; the public X/Y/Width/Height fields on the *Int32 structs), so these were accidental narrowings. new PointInt32(x, y) / new SizeInt32(w, h) are the idiomatic forms used throughout the AppWindow / windowing APIs and now compile against Uno as they do against WinAppSDK.

How they were found

The whole public/protected surface of Uno.UI, Uno.UWP, Uno.Foundation, Uno.UI.Composition and Uno.UI.Dispatching was diffed against the WinAppSDK 2.1 reference assemblies (Microsoft.WinUI.dll, Microsoft.Windows.SDK.NET.dll, Microsoft.InteractiveExperiences + Microsoft.Windows.* projections — the same set the sync generator references), reflected via MetadataLoadContext. Every member Uno declares narrower than the reference exposes was flagged, then verified against the WinUI IDL / MS Learn. This generalizes the recurring #23653 shape to all member kinds (fields, properties, events, methods, constructors) across every WinRT-facing assembly.

Uno.Foundation and Uno.UI.Dispatching were clean (zero findings). All remaining flagged constructors were investigated and ruled out as WinRT projection artifacts — the projected Foo(DerivedComposed) composability constructor on unsealed base types (Visual, CompositionBrush, AppWindowPresenter, InfoBar*EventArgs, …) and abstract-base constructors, which match only by parameter count and are not real developer API — and left untouched.

PR Checklist ✅

  • 🧪 Added Runtime tests — n/a: these are accessibility-only changes with no runtime behavior; correctness was validated by re-diffing each rebuilt Uno assembly against the reference (all eight resolved, no regressions).
  • 📚 Docs — n/a (no API behavior change).
  • 🖼️ Validated PR Screenshots Compare Test Run results — n/a (no visual change).
  • ❗ Contains NO breaking changes — widening accessibility is additive and source/binary compatible.
  • 👀 Reviewed 2 other open pull requests

Five members were declared narrower than the WinUI reference surface,
the same class of defect as #23653 (Hyperlink.UnderlineStyleProperty),
silently blocking external use despite the type being public:

- ItemsRepeaterScrollHost.HorizontalAnchorRatio (internal -> public)
- ItemsRepeaterScrollHost.VerticalAnchorRatio   (internal -> public)
- RepeatedScrollSnapPoint.Start                 (private  -> public)
- RepeatedScrollSnapPoint.End                   (private  -> public)
- ItemsSourceView.IndexOf(object)               (internal -> public)

Each was confirmed against the WinAppSDK 2.1 reference assembly and the
WinUI IDL. Widening accessibility is additive and non-breaking.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011xvpioeKGiCR8NnouBZHwY
Copilot AI review requested due to automatic review settings July 7, 2026 09:26
@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 24s —— View job


Review complete

  • Gather context
  • Read changed files (ItemsRepeaterScrollHost.cs, ItemsSourceView.cs, SnapPoint.cs)
  • Verify WinUI parity claims and structural correctness
  • Post findings

Verdict: ✅ LGTM — no issues found

0 blocking issues, 0 warnings.

All five changes are accurate, additive, and structurally clean:

Member Analysis
ItemsRepeaterScrollHost.HorizontalAnchorRatio/VerticalAnchorRatio IScrollAnchorProvider in Uno does not include these (confirmed via IScrollAnchorProvider.cs) — they are direct class properties. CurrentAnchor is already public on the same class; the narrowing was accidental.
RepeatedScrollSnapPoint.Start/End Both are { get; } init-only auto-properties set in the constructor. RepeatedZoomSnapPoint.Start/End (lines 1495–1496 of the same file) are already public — the scroll variant was inconsistently narrower. Making them public exposes the raw constructor values; the alignment-adjusted variants remain internal via ActualStart()/ActualEnd().
ItemsSourceView.IndexOf(object item) Identical pattern to the already-public GetAt, IndexFromKey, and KeyFromIndex on the same class — accidental narrowing.

No behavior changes, no interface contract disruption, no API breakage — widening is source- and binary-compatible. The checklist rationale (no runtime tests needed for pure accessibility fixes) is valid.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR widens the accessibility of a small set of Microsoft.UI.Xaml.* API members to match the WinUI reference surface, preventing external consumers from being blocked by unintentionally narrow members on otherwise-public types.

Changes:

  • Made RepeatedScrollSnapPoint.Start / End public read-only properties.
  • Made ItemsSourceView.IndexOf(object) public.
  • Made ItemsRepeaterScrollHost.HorizontalAnchorRatio / VerticalAnchorRatio public settable properties.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Uno.UI/UI/Xaml/Controls/ScrollPresenter/SnapPoint.cs Exposes RepeatedScrollSnapPoint.Start/End publicly to align with WinUI’s public API surface.
src/Uno.UI/UI/Xaml/Controls/Repeater/ItemsSourceView.cs Exposes ItemsSourceView.IndexOf(object) publicly for WinUI parity and external consumption.
src/Uno.UI/UI/Xaml/Controls/Repeater/ItemsRepeaterScrollHost.cs Exposes anchor ratio properties publicly to match WinUI accessibility on a public control.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

PointInt32, RectInt32 and SizeInt32 declared their parameterized
constructors `internal`, while the WinAppSDK projection exposes them as
`public` — so `new PointInt32(x, y)` (used throughout the AppWindow /
windowing APIs) compiles against WinAppSDK but not Uno.

Found by extending the reflection-vs-reference accessibility sweep to
Uno.UWP / Uno.Foundation / Uno.UI.Composition / Uno.UI.Dispatching.
Widening matches the reference surface and is additive / non-breaking.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011xvpioeKGiCR8NnouBZHwY
@unodevops

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 6s —— View job


Review complete

  • Gather context
  • Read changed files (ItemsRepeaterScrollHost.cs, ItemsSourceView.cs, SnapPoint.cs, PointInt32.cs, RectInt32.cs, SizeInt32.cs)
  • Verify WinUI parity claims and structural correctness
  • Post findings

Verdict: ✅ LGTM — no issues found

0 blocking issues, 0 warnings.

Each change was cross-checked against the corresponding generated reference file in src/*/Generated/3.0.0.0/…, which records the WinUI-derived surface the code generator expected and was already silently skipping as "already declared":

Member Generated-file evidence Sibling consistency
ItemsRepeaterScrollHost.HorizontalAnchorRatio // Skipping already declared property HorizontalAnchorRatio (get+set noted) CurrentAnchor, ScrollViewer already public on same class
ItemsRepeaterScrollHost.VerticalAnchorRatio // Skipping already declared property VerticalAnchorRatio (get+set noted) same
RepeatedScrollSnapPoint.Start // Skipping already declared property Start Offset, Interval already public; RepeatedZoomSnapPoint.Start (line 1495) already public
RepeatedScrollSnapPoint.End // Skipping already declared property End same
ItemsSourceView.IndexOf(object) // Skipping already declared method … IndexOf(object) GetAt, IndexFromKey, KeyFromIndex all already public
PointInt32(int,int) // Skipping already declared method … PointInt32(int, int) struct fields X/Y already public
RectInt32(int,int,int,int) // Skipping already declared method … RectInt32(int, int, int, int) The internal Contains(…) helpers are Uno-specific, not in WinUI — correctly left internal
SizeInt32(int,int) // Skipping already declared method … SizeInt32(int, int) struct fields Width/Height already public

The checklist rationale (no runtime tests for pure accessibility widening) is valid. All changes are source- and binary-compatible: no API behavior changed, no interface contract was altered.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 221033 did not find any UI Test snapshots differences.

@mergify

mergify Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@MartinZikmund
MartinZikmund merged commit 9bfbb0c into feature/breakingchanges Jul 8, 2026
48 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/publicprotected branch July 8, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants