You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(api)!: Match WinUI accessibility and get-only properties - #24634
This re-enables the sync generator's accessibility and read-only property matching, which had been commented out. Uno's public surface now matches WinUI for everything those checks find.
Why not just uncomment the checks? As written, they flag hundreds of members that already match WinUI:
Comparing IsReadOnly directly flags every Uno property with an internal/private setter, even though its public surface is get-only like WinUI's (456 stubs in 185 files). IsWriteOnly never matters: WinAppSDK has no set-only properties.
Comparing DeclaredAccessibility on types misfires, because Generated/ is deleted before the compilations load. It's also unnecessary: C# already rejects a hand-written partial whose accessibility conflicts with the generated one.
What the generator now checks (SymbolMatchingHelpers):
Properties: whether each accessor is visible outside the assembly.
Members: declared accessibility, treating Uno's protected internal as the protected other assemblies see. Types are left to the compiler.
The code comment claiming Roslyn reports public interface implementations as private is gone: that no longer happens (zero hits).
Divergences fixed (the list is exactly what the new checks report):
77 get-only properties had public setters. Examples: ButtonBase.IsPointerOver, Thumb.IsDragging, UIElement.FocusState, Hyperlink.FocusState, Popup.ActualPlacement, ItemsControl.ItemsPanelRoot, Visual.Parent, VisualState(Group).Name, TextElement.Name, the *TemplateSettings properties, ScrollView/ScrollPresenterComputed*, and the InteractionTrackerInertiaStateEnteredArgs properties (those were required init). Setters Uno writes itself are now internal. Setters that only threw (read-only collection Count, Keys, Values, IsReadOnly, indexers) are removed.
Accessibility:
Control.GetTemplateChild, NonVirtualizingLayoutContext.ChildrenCore, and the DoubleKeyFrame/ObjectKeyFrame/Timeline/AutomationPeer constructors are now protected, as in WinUI (they were public).
The ColorPickerSliderAutomationPeer constructor is now public (it was internal).
Where framework code calls a member from outside the type, it's protected internal. GetTemplateChild needs this: otherwise internal callers silently bind to an internal FindName-based extension method.
XAML codegen:
x:Name on a type whose Name is get-only (VisualState, VisualStateGroup, TextElement) now goes through a new hidden MarkupHelper.SetXName, like SetXUid. Before, the codegen emitted a Name = "…" initializer into the user's assembly, which only compiled while the setter was public. The types opt in via an internal IXNameProvider (mirroring IXUidProvider). A type that makes Name get-only without it fails to compile on the Name = "…" fallback rather than dropping x:Name silently. This covers direct children of a ResourceDictionary too, e.g. a standalone dictionary file.
⚠️ Intentional WinUI divergence: a plain Name="…" is accepted wherever Name is get-only (TextElement subtypes like Run/Hyperlink/Span, and VisualState/VisualStateGroup) and treated like x:Name. WinUI's XAML compiler rejects it with WMC0050, and I confirmed that in a blank WinUI app. But WinUI's runtime parser (XamlReader) accepts it like x:Name, and Uno accepted it before this PR while the setters were public. Given_PlainName covers the compiled path at runtime.
Latent bug fixed (separate fix + test commits): a get-only content collection emitted as Children = { … } had no trailing comma. So an initializer member generated after it, e.g. from x:Uid, produced invalid C# (CS1003). Making RadioButtons.Items get-only exposed this.
Validation
Sync generator: regeneration with the tightened matcher is byte-identical. Before the fixes, it emitted duplicate stubs for all 79 members (plus 11 constructors and indexers).
Source generator tests: 497 total, 0 failed. The new When_Xuid_On_Element_With_Content_Collection test fails with CS1003 without the fix.
Runtime (Skia Desktop): Given_VisualStateManager, Given_ObjectAnimationUsingKeyFrames and RadioButtonsTests all pass (27/27, 1 skipped).
Compile (net11): Uno.UI, Uno.UI.RuntimeTests.Skia, Uno.UI.UnitTests, SamplesApp (desktop), Uno.WinRT Wasm/iOS, and the Win32 and WebAssembly Skia runtimes.
PackageDiff: 56 ignore entries in the 6.7 set, generated from this PR's CI output. Validated locally against the CI-built nupkgs for all 19 diffed packages, which all pass. The WinRT setter removals don't appear because Uno.WinRT's 6.7 baseline doesn't contain those types (7.0 assembly rename).
Runtime Name parity (Skia Desktop): Given_XamlReader_Name passes 5/5. It covers plain Name and x:Name on Run and Hyperlink through XamlReader, and GoToState finding a plain-NameVisualState. Each case was first checked against a blank WinUI app. WinUI's runtime parser treats plain Name like x:Name. Its XAML compiler rejects plain Name on these types (WMC0050), and Uno's generated code now fails with CS0200.
x:Name in resources: Given_GetOnlyName covers Page.Resources and a standalone ResourceDictionary. Before the fix, the dictionary case compiled and dropped the name.
Breaking changes (7.0): code that set the listed properties or called the listed members publicly must stop doing so, since WinUI doesn't allow it either. Tests and samples that constructed a bare ObjectKeyFrame should use DiscreteObjectKeyFrame. XAML using x:Name keeps working through the new codegen path.
src/Uno.UI/Helpers/MarkupHelper.cs: SetXName is a hardcoded, closed switch over three concrete types, while the codegen decides generically (via reflection) whether to call it. A future type gaining a non-public Name setter — following this very PR's own pattern — would silently drop x:Name at runtime with no compiler error or diagnostic.
Cross-cutting observations (not blocking, no line to anchor to)
SymbolMatchingHelpers changes are internally consistent: GetExternalAccessibility correctly folds protected internal → protected for external visibility, IsPubliclyAccessible correctly treats private/internal/private protected as non-public, and type-level accessibility is correctly left to the compiler (a hand-written partial can't diverge from the generated one). Spot-checked several of the ~90 property/constructor accessibility fixes (ButtonBase.IsPointerOver, Popup.ActualPlacement, Control.GetTemplateChild, ObjectKeyFrame/DoubleKeyFrame/Timeline constructors, ColorPickerSliderAutomationPeer) — all match the stated WinUI-parity intent, and no remaining internal call sites break (e.g. new ObjectKeyFrame() is gone, GetTemplateChild cross-assembly callers all go through this/same-assembly access).
The RequestId/etc. properties on InteractionTrackerInertiaStateEnteredArgs had to drop required entirely (not just gain internal init) — this is very likely a compiler-forced consequence of required members needing to be at least as visible as the containing type, not a weakening of a safer alternative that was available. The single construction site (InteractionTrackerInertiaState.cs) still sets every property, so no behavior gap today.
The XAML codegen trailing-comma fix (XamlFileGenerator.cs) and its When_Xuid_On_Element_With_Content_Collection regression test correctly reproduce and fix the CS1003 root cause; the generated baseline diffs are the expected mechanical trailing-comma additions.
Per the PR description, PackageDiff ignore entries are intentionally not yet included (to be generated from this PR's own CI output) — expected to follow before merge.
The PR is correctly labeled ! (breaking) and the description enumerates the affected members; the "Docs updated" checklist item is left unchecked, worth confirming whether the breaking-change list needs a doc/changelog entry before merge.
· branch
Review MarkupHelper.SetXName and XAML codegen changes
Review runtime test updates
Review generated test baseline diffs
Post inline findings
Post summary
Verdict: ship (with 1 non-blocking finding)
1 finding posted inline (moderate — silent-failure risk, same class as a previously-flagged issue but a distinct trigger path):
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs:6295 — the x:Name fallback used for objects whose declaring type doesn't resolve now silently emits nothing for get-only Name types instead of falling back to MarkupHelper.SetXName. Traced the two code paths that can set Name: for a normal named element, BuildExtendedProperties (line 3591) independently calls SetXName, so nothing breaks there. But that path is gated off whenever the named object is a direct child of a ResourceDictionary (explicit or implicit, e.g. Page.Resources) — in that position, the line-6295 fallback was previously the only mechanism setting Name, and it now drops x:Name on a ResourceDictionary-nested VisualState/VisualStateGroup/TextElement with no compiler error and no runtime exception.
Cross-cutting observations (not blocking)
SymbolMatchingHelpers: GetExternalAccessibility correctly folds protected internal → protected for external visibility, IsPubliclyAccessible correctly treats private/internal/private protected as non-public, and leaving type-level accessibility to the compiler is sound (a hand-written partial can't diverge from the generated one). Spot-checked several of the accessibility fixes (ButtonBase.IsPointerOver, Popup.ActualPlacement, Control.GetTemplateChild, the animation-keyframe constructors, ColorPickerSliderAutomationPeer) — all match WinUI parity.
Verified Control.GetTemplateChild going from public to protected internal doesn't break the Uno.UI.RuntimeTests/Uno.UI.RuntimeTests.Skia call sites that invoke it on an arbitrary instance from outside any Control subclass (e.g. Given_TabView.cs) — both assemblies are covered by Uno.UI's InternalsVisibleTo, so the internal half of protected internal applies even though the protected half wouldn't.
InteractionTrackerInertiaStateEnteredArgs: dropping required (not just adding internal init) is the correct compiler-forced consequence of tightening the setters' visibility; the single construction site (InteractionTrackerInertiaState.cs) still sets every property, so there's no behavior gap.
The XAML codegen trailing-comma fix and its When_Xuid_On_Element_With_Content_Collection regression test correctly reproduce and fix the CS1003 root cause; a trailing comma is legal in a C# object initializer, so the unconditional extra comma is safe.
The ObjectKeyFrame → DiscreteObjectKeyFrame runtime test rename is a correct mechanical follow-up now that the base constructor is protected.
PackageDiff ignore entries are intentionally deferred per the PR description (to be generated from this PR's own CI output) — worth confirming before merge.
· branch
This job re-triggered on the same commit (8ec77a6a) already covered by the two prior automated reviews — master moved underneath the PR (merge commit from #24599), but no new commits landed on this branch since. I re-verified the diff end-to-end rather than re-posting duplicate comments.
Both previously-flagged findings remain open (not yet addressed in this branch):
src/Uno.UI/Helpers/MarkupHelper.cs:46 — SetXName's closed switch over three concrete types has no default case; a future type gaining a non-public Name setter (following this PR's own accessibility pattern) would silently no-op instead of failing loudly.
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs:6295 — the fallback now silently drops x:Name when HasNonPublicNameSetter is true and the object is a direct child of a ResourceDictionary (the only case where BuildExtendedProperties's SetXName emission at line 3591 doesn't already cover it).
Additional verification performed this pass, no issues found:
Re-derived SymbolMatchingHelpers.GetExternalAccessibility/IsPubliclyAccessible/type-accessibility-skip logic from the current diff (not just the PR description) — folds protected internal → protected, treats a null accessor (no getter/setter) as non-public on both sides consistently, and correctly exempts INamedTypeSymbol from the member-accessibility comparison while still checking it for events/fields/properties/methods/type parameters via the shared AreMatchingCommon.
Checked every WinRT collection type that lost a throw-only setter (DataPackagePropertySet(View), XmlNamedNodeMap, XmlNodeList, DeviceInformationCollection, FileExtensionVector, FilePickerFileTypesOrderedMap, FilePickerSelectedFilesArray, UIElementWeakCollection) against the interface each one actually implements (IReadOnlyList<T>/IReadOnlyDictionary<K,V>/ICollection<T>.Count/IsReadOnly, all get-only in their interface contracts) — none require a setter, so removing the throw-only stub doesn't break the interface. Where a type does implement a mutable interface (FileExtensionVector : IList<string>, FilePickerFileTypesOrderedMap : IDictionary<...>), the interface-mandated indexer/Add/etc. setters are untouched — only the non-mandated Count/IsReadOnly/Keys/Values setters were dropped.
InteractionTrackerInertiaStateEnteredArgs: confirmed dropping required (not just adding internal init) is compiler-forced once the setters go non-public, and the single construction site still sets every property.
RadioButtons.Items and the Given_ObjectAnimationUsingKeyFrames → DiscreteObjectKeyFrame rename are mechanical, consistent follow-ups of the constructor/setter visibility changes.
No new issues found beyond the two above. PackageDiff ignore entries are still intentionally deferred per the PR description.
· branch
Verdict: ship (2 previously-flagged findings still open, no new issues)
This trigger re-runs on the same diff already covered by three prior automated passes (git diff origin/master...HEAD is byte-identical to what was reviewed before) — master has moved underneath the PR again, but no new commits landed on this branch. Per the last pass's approach, I didn't re-post duplicate inline comments for findings that are still visible and unresolved on the PR.
Both previously-flagged findings remain open:
src/Uno.UI/Helpers/MarkupHelper.cs:46 — SetXName's closed switch over three concrete types still has no default case; a future type gaining a non-public Name setter would silently no-op instead of failing loudly.
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs:6302 — the fallback still silently drops x:Name when HasNonPublicNameSetter is true and the object is a direct child of a ResourceDictionary (the one position BuildExtendedProperties's SetXName emission at line 3591 doesn't cover).
No new issues found against this run's checklist (SOLID/separation of concerns, async/cancellation discipline, cross-platform file-suffix correctness, DependencyProperty correctness, events, allocations, test coverage, XAML/XamlStyler conventions, release-build cleanliness, Conventional Commits): the diff introduces no new async code, no event Action/Action<T> declarations, no new DependencyProperty registrations, and no hot-path allocations — it's confined to accessibility/get-only modifiers, the MarkupHelper/codegen support for those, and mechanical test-baseline/runtime-test follow-ups. InteractionTrackerInertiaStateEnteredArgs dropping required in favor of internal init is confirmed as compiler-forced (a required member can't be less visible than its containing type) with no behavior gap at its single construction site. Commit messages and PR title follow Conventional Commits (refactor(api)!), and the breaking change is documented in the PR description.
PackageDiff ignore entries remain intentionally deferred per the PR description.
· branch
Both findings from the earlier review passes are now resolved by commits cc7268f8 ("fix(xaml): Set get-only x:Name through IXNameProvider") and c65a86fb (regression test):
MarkupHelper.SetXName closed switch → replaced with an internal IXNameProvider interface (src/Uno.UI/UI/Xaml/IXNameProvider.cs), exactly mirroring the existing IXUidProvider/SetXUid pattern. VisualState, VisualStateGroup, and TextElement now implement IXNameProvider explicitly (void IXNameProvider.SetXName(string name) => Name = name;). A future type gaining a non-public Name setter without implementing the interface now fails to compile at its own Name initializer (the interface requires an explicit implementation) instead of silently no-opping at runtime — the coupling is enforced by the type system, not a manually-maintained switch.
ResourceDictionary-nested x:Name silently dropped → XamlFileGenerator.cs's BuildExtendedProperties gained a new branch (~line 3577) that calls BuildSetXName whenever IsXNameProvider(objectDefinition.Type) is true, independent of the !isMemberInsideResourceDictionary.isInside gate that previously skipped this codepath for RD-nested elements. Verified empirically: the new Given_GetOnlyName test's generated baseline (Out/GetOnlyName/WhXNaOnReWiGeOnNa/XCG_Dictionary.cs) now emits MarkupHelper.SetXName(__p1, "DictionaryStateName") for a VisualState declared as a direct child of a standalone <ResourceDictionary>, which was the exact scenario that previously compiled but dropped the name at runtime with no diagnostic.
The generator-side rename HasNonPublicNameSetter → IsXNameProvider (XamlFileGenerator.Reflection.cs) switches from a fragile "is the setter non-public" reflection check to "does the type implement the marker interface," resolved via GetOptionalSymbolAsLazy(XamlConstants.Types.IXNameProvider) — the same established pattern already used for other optional-symbol lookups (e.g. AssemblyMetadataSymbol), so it degrades gracefully when compiling against an older Uno.UI reference that predates the interface.
One remaining low-severity, non-blocking observation: the separate literal-property fallback in BuildLiteralPropertiesWithFilter (XamlFileGenerator.cs:6280-6290, reached when member.Member.DeclaringType == null && member.Member.Name == "Name") still only guards against emitting the now-invalid Name = "..." initializer when IsXNameProvider is true — it doesn't call BuildSetXName in that branch. This is a distinct, narrower code path from the one just fixed (triggered when the "Name" directive's declaring type doesn't resolve, e.g. templated/custom-type scenarios), and I could not confirm it's reachable today for any of the three current IXNameProvider implementers (all well-known compiled framework types that resolve normally through FindType). The concrete regression this PR set out to fix (RD-nested x:Name) is verified fixed by the new test. Worth a follow-up glance if a future get-only-Name type is ever routed through this fallback, but not blocking.
Cross-cutting observations (not blocking)
PackageDiffIgnore.xml now includes the ~57 ignore entries for the accessibility/get-only breaking changes (previously flagged as "not yet done" in the PR description) — generated from this PR's own surface changes, consistent with the get-only/accessibility fixes reviewed in prior passes.
No new event Action/Action<T> declarations, no new DependencyProperty registrations, no .Result/.GetAwaiter().GetResult(), and no cross-platform file-suffix violations introduced by this round's changes — confined to MarkupHelper, the new IXNameProvider interface/implementers, generator wiring (XamlCodeGeneration.cs, XamlConstants.cs), and the corresponding test baselines.
Conventional Commits followed throughout (fix(xaml), test(xaml), chore).
· branch
The only commit added since the last full review (which covered through c65a86fb) is aad10cc0 ("test(xaml): Cover runtime Name on get-only Name types") — a test-only addition (src/Uno.UI.RuntimeTests/Microsoft/UI/Xaml/Markup/Given_XamlReader_Name.cs, +80/-0, no production code changed).
Verified this test is meaningful, not a no-op: it targets Microsoft.UI.Xaml.Markup.XamlReader.Load, a runtime XAML parser (XamlObjectBuilder) distinct from the compile-time source generator this PR already extensively modified. Traced its Name/x:Name handling (XamlObjectBuilder.cs:577-601): it resolves the property via TypeResolver.GetPropertyByName (found through the still-public getter) and invokes propertyInfo.SetMethod directly via reflection — which returns the accessor MethodInfo regardless of its own declared accessibility, and MethodInfo.Invoke bypasses normal access checks. So tightening VisualState/VisualStateGroup/TextElement/Run/Hyperlink's Name setters to internal earlier in this PR does not break this runtime path — but that's exactly the kind of assumption worth locking down with a regression test, which is what this commit does for both the plain Name and x:Name attribute forms, including the runtime VisualStateManager.GoToState round-trip scenario.
Style/convention check (all pass): class-level [RunsOnUIThread], correct folder (Microsoft/UI/Xaml/Markup/) mirroring the WinUI namespace with the legacy C# namespace form (Windows_UI_Xaml_Markup, consistent with sibling files in the same folder), synchronous void test methods where no await is used vs. async Task for the one that awaits UITestHelper.Load, and WindowHelper.WindowContent = null reset in a finally block.
No issues found; nothing to flag as inline comments this round.
Gather context (PR description, prior review findings, diff since last review)
Identify new commits since last review pass (aad10cc0): cc7268f8/c65a86fb/aad10cc0 were already reviewed; 4cdf4bc1 (feat) and f5a20e52 (test) are new
Review feat(xaml): Accept plain Name on TextElement (4cdf4bc1)
Review test(xaml): Cover plain Name on TextElement (f5a20e52)
Post inline findings
Post summary
Verdict: ship (1 new non-blocking finding)
New since the last review pass: two commits generalize the get-only-Name handling to accept a plainName="..." attribute (no x: prefix) on TextElement and its subtypes (Run, Hyperlink, etc.), diverging intentionally from WinUI's XAML compiler (which rejects this with WMC0050) to match WinUI's runtime parser and its documented behavior.
Traced the mechanism end-to-end and it's correct:
IsXNameMember (XamlFileGenerator.Reflection.cs) now returns true for Name either in the x: namespace or when the object type is a TextElement (checked via the existing base-type-walking IsType, so it correctly covers subtypes, not just TextElement itself).
BuildExtendedProperties (XamlFileGenerator.cs ~3541-3583) uses this to (a) register the name in __nameScope and (b) call MarkupHelper.SetXName instead of relying on the (non-public) Name setter, for both the x:Name and plain-Name forms.
Critically, BuildLiteralProperties's PropertyFilter (~line 6100) gained a matching !IsXNameMember(...) exclusion — without it, plain Name="..." on a Run/Hyperlink would also flow through the normal object-initializer property list (Name = "..."), which would fail to compile (TextElement.Name has an internal set). This exclusion is what makes the fix actually work rather than just add a redundant call.
Verified against the generated baseline (Out/GetOnlyName/WhPlNaOnTeEl/XCG_MainPage.cs): output is exactly __nameScope.RegisterName(...) + backing-field assignment + MarkupHelper.SetXName(__p1, "PlainRun") — no direct Name = assignment on the element itself.
The new Given_GetOnlyName.When_Plain_Name_On_TextElement test compiles the generated code against a real Uno NuGet reference (ReferenceAssemblies = _Dotnet.Current.WithUnoPackage()), not just an in-solution project reference — so it would genuinely catch the CS0272/read-only-setter compile error this fix prevents, not just IVT-masked success (SamplesApp has InternalsVisibleTo from Uno.UI, which would otherwise hide this class of bug).
1 new inline finding (moderate, non-blocking — test coverage): the new behavior is only verified at compile-time (generator snapshot + compiles-against-package). No Uno.UI.RuntimeTests test exercises the compiled source-generator path for plain Name on a TextElement — the existing Given_XamlReader_Name test covers the same syntax but through the unrelated XamlReader.Load reflection parser. Posted inline on Given_GetOnlyName.cs:70 with a concrete suggestion.
No new issues found in cross-cutting checks for this round (SOLID, async/cancellation, cross-platform suffixes, events, allocations, Conventional Commits): both new commits are scoped to XAML source-generator logic and a test; no async code, no event Action, no new DependencyProperty, no platform-suffix concerns.
· branch
A plain Name on an IXNameProvider type is treated as x:Name, but the
check also matched attached properties such as AutomationProperties.Name.
That registered the label as the element's name, called SetXName with it
and dropped the AutomationProperties.SetName call.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
This trigger re-runs on a branch whose content is identical to what was already fully reviewed. git diff origin/master...HEAD --stat reports the same 126 files changed, 1876 insertions(+), 148 deletions(-) as the last full pass, and the 16 local commits (3461eef7…1afee655) are a 1:1 content match for the commits already reviewed under their pre-rebase SHAs (e.g. today's 80260cd9/1afee655 are the same "keep attached Name properties" fix + test previously reviewed as fb7b10f3/dff9d2e9) — only the SHAs changed, from a rebase onto a newer master.
Re-verified directly rather than trusting the SHA mapping:
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs:150-153 — IsXNameMember still requires !IsAttachedProperty(member) for the IsXNameProvider fallback, confirming the Copilot-flagged AutomationProperties.Name regression stays fixed.
src/Uno.UI/Helpers/MarkupHelper.cs — SetXName still delegates through IXNameProvider rather than a closed switch, confirming the first-round silent-failure finding stays fixed.
No new issues found. Every finding raised across this PR's review history (the MarkupHelper.SetXName closed-switch risk, the ResourceDictionary-nested x:Name drop, the missing compiled-codegen runtime test for plain Name, and Copilot's attached-property misclassification) was resolved on this branch and is unchanged in the current diff. The PR already carries a human approval (Xiaoy312).
No cross-cutting concerns beyond what's already been raised in prior passes.
· branch
The reason will be displayed to describe this comment to others. Learn more.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Gather context (PR description, full prior review history, trigger context)
Identify what changed since the last full review pass
Re-verify diff against AGENTS.md checklist
Post inline findings (none — see below)
Post summary
Verdict: ship — no new findings
Only one commit landed since the last full review pass (2026-10-03): 44a85b34 ("test(xaml): Refresh x:Bind non-DependencyObject golden"), a one-line, test-snapshot-only change (src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Out/Binding/WhXBiOnNoDeObPr/XCG_MainPage.cs, +1/-0). It adds a trailing comma after an inline content-collection initializer — the same mechanical, always-legal-in-C#-object-initializers fix already introduced by this PR's first commit (3461eef7) and explained in detail by the author in earlier review threads. A binding golden added on master after this branch's last rebase hadn't picked up that trailing comma yet; this commit refreshes it to match. No production logic changed.
All 16 other commits on this branch are content-identical to what's already been reviewed across ten prior automated passes (confirmed via commit message + diff comparison) — this synchronize trigger reflects a rebase/merge pickup, not new substantive work.
No new issues found. Every finding raised across this PR's review history remains resolved:
MarkupHelper.SetXName closed-switch silent-failure risk → fixed via IXNameProvider.
ResourceDictionary-nested x:Name silently dropped → fixed in BuildExtendedProperties.
Missing runtime test for the compiled plain-Name codegen path → added (Given_PlainName).
Copilot's AutomationProperties.Name misclassified as x:Name → fixed (IsXNameMember now excludes attached properties).
PR already carries a human approval (Xiaoy312).
· branch
An inherited IXNameProvider does not necessarily own the resolved Name property. For example, a custom Span subclass with public new string Name { get; set; } inherits the interface, so a plain Name="Example" is filtered out of the normal initializer and passed to TextElement.SetXName instead. The custom property remains unset. Resolve Name first and route it through the helper only when its declaring type directly implements the provider; add a regression test for a subclass that hides Name.
Distinguish public and protected accessor accessibility
The new accessor check loses the distinction between public and protected access. For example, otherwise identical public properties with get; set; and get; protected set; pass both AreMatchingCommon and this check, although only one allows callers outside derived classes to assign it. Compare normalized accessor accessibility, keeping public distinct from protected while treating absent/internal/private accessors as not externally accessible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area/buildCategorizes an issue or PR as relevant to build infrastructurearea/code-generationCategorizes an issue or PR as relevant to code generation
5 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: closes unoplatform/uno-private#2085
PR Type:
🔄 Refactoring
What changed? 🚀
This re-enables the sync generator's accessibility and read-only property matching, which had been commented out. Uno's public surface now matches WinUI for everything those checks find.
Why not just uncomment the checks? As written, they flag hundreds of members that already match WinUI:
IsReadOnlydirectly flags every Uno property with aninternal/privatesetter, even though its public surface is get-only like WinUI's (456 stubs in 185 files).IsWriteOnlynever matters: WinAppSDK has no set-only properties.DeclaredAccessibilityon types misfires, becauseGenerated/is deleted before the compilations load. It's also unnecessary: C# already rejects a hand-written partial whose accessibility conflicts with the generated one.What the generator now checks (
SymbolMatchingHelpers):protected internalas theprotectedother assemblies see. Types are left to the compiler.Divergences fixed (the list is exactly what the new checks report):
ButtonBase.IsPointerOver,Thumb.IsDragging,UIElement.FocusState,Hyperlink.FocusState,Popup.ActualPlacement,ItemsControl.ItemsPanelRoot,Visual.Parent,VisualState(Group).Name,TextElement.Name, the*TemplateSettingsproperties,ScrollView/ScrollPresenterComputed*, and theInteractionTrackerInertiaStateEnteredArgsproperties (those wererequired init). Setters Uno writes itself are nowinternal. Setters that only threw (read-only collectionCount,Keys,Values,IsReadOnly, indexers) are removed.Control.GetTemplateChild,NonVirtualizingLayoutContext.ChildrenCore, and theDoubleKeyFrame/ObjectKeyFrame/Timeline/AutomationPeerconstructors are now protected, as in WinUI (they were public).ColorPickerSliderAutomationPeerconstructor is now public (it was internal).protected internal.GetTemplateChildneeds this: otherwise internal callers silently bind to an internalFindName-based extension method.XAML codegen:
x:Nameon a type whoseNameis get-only (VisualState,VisualStateGroup,TextElement) now goes through a new hiddenMarkupHelper.SetXName, likeSetXUid. Before, the codegen emitted aName = "…"initializer into the user's assembly, which only compiled while the setter was public. The types opt in via an internalIXNameProvider(mirroringIXUidProvider). A type that makesNameget-only without it fails to compile on theName = "…"fallback rather than droppingx:Namesilently. This covers direct children of aResourceDictionarytoo, e.g. a standalone dictionary file.Name="…"is accepted whereverNameis get-only (TextElementsubtypes likeRun/Hyperlink/Span, andVisualState/VisualStateGroup) and treated likex:Name. WinUI's XAML compiler rejects it with WMC0050, and I confirmed that in a blank WinUI app. But WinUI's runtime parser (XamlReader) accepts it likex:Name, and Uno accepted it before this PR while the setters were public.Given_PlainNamecovers the compiled path at runtime.Children = { … }had no trailing comma. So an initializer member generated after it, e.g. fromx:Uid, produced invalid C# (CS1003). MakingRadioButtons.Itemsget-only exposed this.Validation
When_Xuid_On_Element_With_Content_Collectiontest fails with CS1003 without the fix.Given_VisualStateManager,Given_ObjectAnimationUsingKeyFramesandRadioButtonsTestsall pass (27/27, 1 skipped).Uno.UI,Uno.UI.RuntimeTests.Skia,Uno.UI.UnitTests,SamplesApp(desktop),Uno.WinRTWasm/iOS, and the Win32 and WebAssembly Skia runtimes.Nameparity (Skia Desktop):Given_XamlReader_Namepasses 5/5. It covers plainNameandx:NameonRunandHyperlinkthroughXamlReader, andGoToStatefinding a plain-NameVisualState. Each case was first checked against a blank WinUI app. WinUI's runtime parser treats plainNamelikex:Name. Its XAML compiler rejects plainNameon these types (WMC0050), and Uno's generated code now fails with CS0200.x:Namein resources:Given_GetOnlyNamecoversPage.Resourcesand a standaloneResourceDictionary. Before the fix, the dictionary case compiled and dropped the name.PR Checklist ✅
Screenshots Compare Test Runresults.Breaking changes (7.0): code that set the listed properties or called the listed members publicly must stop doing so, since WinUI doesn't allow it either. Tests and samples that constructed a bare
ObjectKeyFrameshould useDiscreteObjectKeyFrame. XAML usingx:Namekeeps working through the new codegen path.🤖 Generated with Claude Code
https://claude.ai/code/session_014tUQkZN1VwVi4CwCkvXRoU