Skip to content

fix: Declare Name on DependencyObject like WinUI - #25184

Open
MartinZikmund wants to merge 29 commits into
dev/mazi/findname-namescopefrom
dev/mazi/dependencyobject-name
Open

MartinZikmund wants to merge 29 commits into
dev/mazi/findname-namescopefrom
dev/mazi/dependencyobject-name

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #25370, part of #21129

Note

Stacked on #25307 (base branch dev/mazi/findname-namescope, GitHub stack #24389). The diff shows only this PR's commits.

Stack, bottom to top:

  1. feat(a11y): add mobile automation support #23935 mobile automation
  2. fix: Resolve FindName through the XAML namescope #25307 FindName / XAML namescope fixes
  3. This PR: DependencyObject-owned NameProperty
  4. fix(a11y): Use owning flyout name for presenter AutomationId #25308 flyout owner-name AutomationId
  5. refactor: Register DependencyObject.Name without the holder #25214 DP storage independent of registration order

Restack notes: chore: Drop stale MenuFlyout Name TODO became empty (#23935 already replaced that line) and was dropped. test: Restore DO Name storage tests for FindName brings back three #25307 tests that need this PR's storage. The last commit, perf: Drop the VisualState Name caches, removes the VisualState/VisualStateGroup field caches (see the GoToState section). DependencyObject.Store.cs is still identical to master.

PR Type:

🐞 Bugfix

What changed? 🚀

In WinUI, FrameworkElement.NameProperty is KnownPropertyIndex::DependencyObject_Name (FrameworkElement.g.cpp:1403). It is declared on DependencyObject, and the XAML parser writes every x:Name there. Uno declared it on FrameworkElement, so x:Name on a brush, MenuFlyout, Run, VisualState, ColumnDefinition and so on was never stored. Reading FrameworkElement.NameProperty on those objects threw (owner validation) or failed the callback cast.

This PR:

  • Registers DependencyObject.NameProperty (internal, owner DependencyObject, default ""). FrameworkElement.NameProperty forwards to the same instance, so the public API is unchanged. The changed callback forwards to FrameworkElement.OnNameChanged and keeps the local Name cache. The runtime owner validation (ValidatePropertyOwner) needs no exemption. The DependencyProperty_Owner reflection unit test lists FrameworkElement.Name as declared on another type, like its other re-exposed DPs.
  • Has the XAML generator (ShouldSetXName) and XamlReader store x:Name on every non-FrameworkElement DO through MarkupHelper.SetXName, even when the type declares its own CLR Name. This follows WinUI's GetRuntimeNameProperty, which always resolves x:Name to DO_Name.
  • Makes TextElement.Name, VisualState.Name and VisualStateGroup.Name follow the DP, as TextElement::get_NameImpl and VisualState::get_Name do. All three read the DP through GetValue. Only FrameworkElement keeps its existing NameCache, set from the DP's backing-field callback. A field cache for VisualState and VisualStateGroup was evaluated and dropped (see the GoToState section below).
  • Coerces a null name to "", matching WinUI's HSTRING storage. Like other DPs, Name is not type-checked.
  • Fixes a generic coercion cost in DependencyPropertyDetails: clearing a coercion that was never applied used to allocate a ModifiedValue just to store Unset, on every set of any coerced DP whose callback returned the base value. It now skips the allocation, and an existing ModifiedValue still gets its coercion cleared. Without this, the Name coercion would add 48 B to every named element compared to master. DependencyObject.Store.cs itself is unchanged by this PR.
  • Registers the DP from FrameworkElement's static initializers, where master registered its own Name DP. Its storage then shares a details bucket with the other FrameworkElement properties, and a named element allocates no more than on master.
  • Makes VisualStateManager.GoToState(control, "") return false without activating an unnamed state, as WinUI does (VisualStateManager_Partial.cpp GoToStateImpl skips an empty name).
  • Makes the property reachable by name only as FrameworkElement.Name, as in WinUI. Without that, {Binding Path=Name} on a brush would start returning the x:Name, where WinUI returns "".

#25308, stacked on this PR, uses this storage for the flyout presenters' AutomationId (WinUI's GetOwnerName).

WinUI vs Uno

The WinUI column comes from a WinAppSDK 2.4.0 oracle app. The Uno columns come from Skia desktop runtime tests (Given_DependencyObject_Name).

Scenario WinUI Uno master This PR
FrameworkElement.NameProperty returns the same instance on every read yes yes yes
Public Name DP on DependencyObject none none none (internal)
x:Name on brush / MenuFlyout / Run / VisualState(Group) -> GetValue(NameProperty) the name throws the name
Brush: default value / ReadLocalValue "" / Unset throws "" / Unset
Brush: SetValue("X"), then GetValue, ClearValue "X", then "" throws "X", then ""
RegisterPropertyChangedCallback on a brush (A, B, clear) fires A, B, "" throws fires A, B, ""
Callback on an unchanged set ("A" three times), brush and Border 3 throws / 1 1 (#25213)
Callback on ClearValue of an unset name 1 throws 0 (#25213)
{Binding Path=Name}: Run / brush (with FallbackValue) "R" / fallback "R" / fallback "R" / fallback
Style setter on Name under a local Name (callbacks) 0 0 0
Style S, then local S, then ClearValue (callbacks) 3 1 1 (#25213)
GoToState(control, "") with an unnamed state false, no state false false, no state
Border.SetValue(NameProperty) <-> Border.Name mirrored mirrored mirrored
x:Name on a custom DO without a Name property stored throws stored
x:Name on a custom DO with its own CLR Name DP only, CLR stays null CLR only DP only, CLR stays null
SetValue(NameProperty, "Q") on Run / VisualState / VisualStateGroup -> .Name "Q" throws "Q"
SetValue(NameProperty, null) "" throws (brush) / null (FE) ""
GetProperty(typeof(Border), "Name") n/a FE.NameProperty same instance

Still different from WinUI:

Allocations

Measured with a headless Skia harness. The figures are bytes allocated per operation on the UI thread, the median of 7 rounds, and they reproduced exactly across alternating runs. Wall-clock is noise on this machine and isn't reported. The named rows ran 10k operations per round, the templated Button 2k.

Workload (bytes/op) master (efa29548ba2) PR before review fixes (32e9d5f8b19) PR now Now vs master
new Border { Name = "x" } 2,160 2,336 2,160 0
new SolidColorBrush() + x:Name (MarkupHelper.SetXName) 600 920 872 +272
new VisualState() + x:Name 552 864 824 +272
Templated Fluent Button: create, enter, layout, leave 132,032 133,672 133,175 +1,143 (+0.9%)
GoToState(PointerOver/Normal) on a loaded Button 1,724 1,724 1,724 0

The "PR now" column was measured while VisualState and VisualStateGroup still had a Name field cache. Dropping it removes one string field (8 B) from each of those objects, so the VisualState row is now slightly lower. That wasn't re-measured.

Per 10k operations: named Border +0 (it was +1.76 MB before the fixes), and named brush or VisualState +2.7 MB. The brush and VisualState cost is the new storage itself: on master a brush dropped its x:Name and VisualState kept it in a CLR field, while both now hold it in DependencyObject_Name's property details, as WinUI does. The templated Button delta comes from its named VisualStates and VisualStateGroups.

GoToState: VisualState/VisualStateGroup Name cache, evaluated and dropped

An earlier revision mirrored VisualState.Name and VisualStateGroup.Name into a field (like WinUI's CDependencyObject::m_strName), because VSM scans these names on every GoToState. It was dropped: real GoToState calls are at most about 3% slower without it (and the CheckBox case is within noise). Only the artificial full-scan miss shows a large relative gap, and that is about 100-300 cycles. The simpler code, where Name reads GetValue(NameProperty) and the backing-field callback only serves FrameworkElement, was worth more than that.

This compares two builds of this PR that differ only in the VisualState.Name/VisualStateGroup.Name getter: the field cache or (string)GetValue(NameProperty). Each figure is the median of 4 alternating launches, each launch itself a median of 7 rounds. Thread cycles are stable, while wall-clock (about 2.9 cycles/ns here) is noisy on this machine. The miss rows call GoToState with a name that matches no state, so they isolate VSM's name scan over every group and state.

Workload (per GoToState) Cache: cycles / ns GetValue: cycles / ns Cache saves
Fluent Button, PointerOver/Normal toggle 17,843 / ~6,045 18,436 / ~6,390 ~590 cycles (3.2%)
Fluent CheckBox, UncheckedPointerOver/UncheckedNormal toggle 38,250 / ~13,090 38,566 / ~13,300 ~320 cycles (0.8%, within noise)
Button, name not found (full scan) 171 / ~60 265 / ~92 ~94 cycles (35%)
CheckBox, name not found (full scan) 283 / ~95 592 / ~200 ~309 cycles (52%)

Allocations are identical in both arms: 1,688 / 3,086 / 72 / 72 B. This PR ships the GetValue arm.

Breaking changes

Both changes are WinUI-aligned with no API change. They are documented in doc/articles/migrating-to-uno-7.md (XAML changes):

  • x:Name on a custom DependencyObject. A non-FrameworkElement DO that declares its own CLR Name or "Name" DP no longer receives x:Name in that property. The name is stored in FrameworkElement.NameProperty instead, as in WinUI. Migration: set the type's own property with a plain Name="...", or read GetValue(FrameworkElement.NameProperty).
  • VisualState names. VisualState.Name and VisualStateGroup.Name default to "" instead of null, as in WinUI. Migration: replace Name == null / Name ?? ... checks with string.IsNullOrEmpty(Name).

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable)
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features)
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes (contains breaking changes: see Breaking changes above, documented in the 7.0 migration guide)
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

🤖 Generated with Claude Code

https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa

Copilot AI balanced review requested due to automatic review settings October 10, 2026 15:23

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added area/code-generation Categorizes an issue or PR as relevant to code generation area/automation Categorizes an issue or PR as relevant to project automation labels Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 20s —— View job


Review of PR #25184

Verdict: ship, with one minor item to resolve.

Issues by severity: 0 blocking, 1 minor (inline), 0 nits.

I reviewed the diff by inspection only. I did not build the code or run any tests.

Cross-cutting notes

  • Moving NameProperty to DependencyObject is consistent across all the places that write x:Name: the XAML generator (ShouldSetXName), XamlObjectBuilder and MarkupHelper.SetXName. IXNameProvider types now write both the CLR name and the DP, as the PR description says.
  • IsNameVisibleOn adds a reference comparison to every FindDependencyProperty lookup, so the extra cost is small. It keeps {Binding Path=Name} on non-FrameworkElement objects the same as before.
  • The behaviours that still differ from WinUI are listed in the description and deferred to Align FindName with WinUI #21129. I found nothing that contradicts them.
  • Test coverage looks good: runtime tests (Given_DependencyObject_Name) and generator snapshot tests (Given_XName).

Comment thread src/Uno.UI/Helpers/MarkupHelper.cs Resolved
Comment thread src/Uno.UI/UI/Xaml/FrameworkElement.cs Resolved
Copilot AI balanced review requested due to automatic review settings October 10, 2026 15:36

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 21s —— View job


Answers to the open review questions

I read the code and did not change anything. I did not build or run tests.

MarkupHelper.SetXName: should the DependencyObject check be else if? (src/Uno.UI/Helpers/MarkupHelper.cs:54)

No, keep it as a separate if. TextElement, VisualState and VisualStateGroup implement IXNameProvider and are also DependencyObjects. The description says an x:Name on these types writes both the CLR Name and DependencyObject.NameProperty. With else if, the DP would stay at "" on those types, and GetValue(FrameworkElement.NameProperty) and RegisterPropertyChangedCallback would not see the name. A short comment on the second if saying that both writes are intentional would help the next reader.

FrameworkElement.NameCache: who invalidates it? (src/Uno.UI/UI/Xaml/FrameworkElement.cs:872)

The backingFieldUpdateCallback in DependencyObject.Name.cs:16 does. The store calls RaiseBackingFieldUpdate (DependencyObject.Store.cs:1969) on every effective value change, before the changed callback runs. That covers SetValue, bindings, styles and ClearValue, where the new value is the default "". The cache is therefore always overwritten on a change and never goes stale. The comment "null until first read" is accurate, and Name fills it lazily with ??=.

Two points to be aware of:

  • NameCache has a private get, so the getter is private. Only FrameworkElement.Name reads it, and the callback writes it through the internal setter.
  • If a change is skipped because the value did not actually change, the cache already holds the right value.

Inline review comment on Given_DependencyProperty.Owner.cs:33

I did not check this one. I did not run the unit test without the ("FrameworkElement", "Name") exemption. The FrameworkElement.NameProperty getter now returns the DependencyObject-owned instance, so the test may need the entry. If it does, the PR description's "no owner-validation exemption is needed" is wrong and should be corrected. If it doesn't, drop the entry.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 16:09

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 34s —— View job


Review of PR #25184 (latest push: 1975ddc2, 9cd556b0)

Verdict: fix-first. 1 inline issue (important), 1 minor note below.

I reviewed by inspection only. I did not build or run tests.

Cross-cutting notes

  • The latest commits now read Name from the DP on TextElement, VisualState and VisualStateGroup. Earlier answers on this PR assumed they kept a CLR field. The DP coerces null to "", so VisualState.Name and VisualStateGroup.Name now default to "" instead of null. I found no Name == null checks in src/Uno.UI. External code may still have them.
  • VisualState.cs and VisualStateGroup.cs lost their UTF-8 BOM. This is unrelated noise in the diff. Please restore it.
  • MarkupHelper.SetXName is now an if / else if. That is fine because the IXNameProvider.SetXName implementations write the DP themselves. The earlier "separate if" discussion no longer applies.
  • IsNameVisibleOn keeps {Binding Path=Name} unchanged for non-FrameworkElement objects.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 16:25

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 33s —— View job


Review of PR #25184 (latest push: 32e9d5f8)

Verdict: fix-first. 0 blocking, 1 important (BOM), 1 minor (perf). Both are inline comments.

I reviewed by inspection only. I did not build or run tests.

Cross-cutting notes

  • The earlier concern that the generator no longer writes the CLR Name is resolved. The description now lists it under "Behavior changes". ShouldSetXName is applied consistently in the three generator sites and in XamlObjectBuilder.
  • The "NO breaking changes" checkbox is unchecked, which is fine. Do keep the description's note that VisualState.Name and VisualStateGroup.Name default to "" rather than null.
  • The ReferenceEquals(..., NameProperty) check in DependencyObject.Store.cs adds a reference comparison to every effective-value change. The cost is negligible and the comment explains the reason.
  • The IsNameVisibleOn guard keeps {Binding Path=Name} on non-FrameworkElement objects unchanged.
  • The (FrameworkElement, Name) exemption in the DependencyProperty_Owner reflection test is needed. It is a different check from the runtime ValidatePropertyOwner.

Comment thread src/Uno.UI/UI/Xaml/VisualState.cs Resolved
Comment thread src/Uno.UI/UI/Xaml/VisualState.cs Resolved
Copilot AI balanced review requested due to automatic review settings October 10, 2026 19:51

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 26s —— View job


Review of PR #25184 (latest push: 9d7b36d8)

Verdict: ship, with one minor inline note. Issues: 0 blocking, 0 important, 1 minor (performance, inline).

Scope: I reviewed by inspection only, and only part of the diff. I read DependencyObject.Name.cs, VisualState.cs and the DependencyObject.Store.cs hunks. I did not build or run any tests, and I could not diff against origin/master because the checkout is shallow. I did not re-read the generator, XamlObjectBuilder, TextElement, VisualStateGroup, VisualStateManager or the test files.

Earlier review concerns, as they look in the code now

  • The BOM was restored on the VisualState files in 91e14d2f.
  • The GoToState hot-path concern is addressed. VisualState, VisualStateGroup, TextElement and FrameworkElement now cache the name through backingFieldUpdateCallback (NameCache), so Name is a field read.
  • The behaviour changes are listed in the PR description and in the 7.0 migration doc. These are the CLR Name no longer receiving x:Name on custom DOs, and VisualState.Name defaulting to "".

Cross-cutting notes

  • The "NO breaking changes" checkbox is unchecked, which matches the described behaviour changes.
  • The cache assumes RaiseBackingFieldUpdate runs on every effective-value change. The VisualState.NameCache default of "" agrees with the DP default.
  • Local VisualState.Name { internal set } routes through SetValue, so the DP and the cache stay in sync.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 21:03

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 32s —— View job


Review of PR #25184 (latest push)

Verdict: ship, with two minor inline items to reconcile. 0 blocking, 0 important, 2 minor (both description/code mismatches).

Scope: inspection only. I did not build or run tests. The checkout is shallow, so I could not diff against origin/master. I read DependencyObject.Name.cs, the DependencyObject.Store.cs notification hunk, DependencyProperty.cs (IsNameVisibleOn), FrameworkElement, VisualState, VisualStateGroup and TextElement. I did not re-read the generator, XamlObjectBuilder, VisualStateManager or the tests.

Cross-cutting notes

  • Earlier concerns now look addressed in the code: the VisualState and VisualStateGroup NameCache mirror, and IsNameVisibleOn keeping {Binding Path=Name} unchanged on non-FrameworkElement objects.
  • The unchanged-write notification check, ReferenceEquals(propertyDetails.Property, NameProperty) && precedence <= newPrecedence, adds one reference comparison per effective-value change. NameProperty goes through the NamePropertyHolder static class. Caching it in a static readonly field on the store would avoid the holder access on that path. That is optional.
  • The breaking changes are listed in the description and the 7.0 migration doc.

MartinZikmund and others added 23 commits November 10, 2026 10:42
Native WinUI's XamlReader can't resolve test-assembly types, so the
XamlReader variants now skip NativeWinUI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
WinUI only raises the always-notify for DependencyObject_Name when the
effective value is written. A Style setter under a local Name now stays
silent, as in WinUI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
The null -> "" coercion allocated a ModifiedValue on every Name set,
including every x:Name'd element, and still stored non-string values.
Normalize null and cast up front instead: a non-string now throws
InvalidCastException before storing, as in WinUI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
VSM reads VisualState and VisualStateGroup names in loops on every
GoToState. Mirror DependencyObject_Name into a field, like WinUI's
m_strName and FrameworkElement's NameCache, instead of a full GetValue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
With VisualState.Name now defaulting to "" like WinUI, GoToState("")
would match an unnamed state. WinUI returns false without changing
state (VisualStateManager_Partial.cpp GoToStateImpl skips an empty
name). Also fix the dead null fallbacks in ToString.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
Move the Uno-only #if inside the test body so discovery sees it, and
give the brush Name binding a FallbackValue: as in WinUI (oracle), the
path doesn't resolve, so the fallback shows rather than a silent "".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
Registered with DependencyObject's statics, the name got a UniqueId in a
details bucket no element otherwise uses, so every named element paid a
16-slot bucket (+128 B per new Border { Name = "x" }). Register it from
FrameworkElement's initializers, where master registered its Name DP:
named Border allocation is back to master's 2,160 B.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
Clearing a coercion that was never applied allocated a ModifiedValue
just to store Unset. Every set of a coerced DP whose coercion returns the
base value hit it, Name included (48 B per x:Name'd element). Skip the
allocation when nothing is coerced; an existing ModifiedValue still gets
its coercion cleared.

Name goes back to a plain null -> "" coercion instead of its own type
check in the store, since Uno doesn't type-check other DPs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
TextElement.Name isn't read on a hot path, so it reads the DP directly
again; only the VSM lookups keep a field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
Name change callbacks go back to master's plain AreDifferent check, so
this PR leaves DependencyObject.Store.cs unchanged. WinUI's notify on an
unchanged effective write is tracked as a follow-up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
GoToState is only about 3% slower reading the DP directly, so
VisualState and VisualStateGroup read Name through GetValue again;
only FrameworkElement keeps a field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
Copilot AI balanced review requested due to automatic review settings November 10, 2026 10:00
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/dependencyobject-name branch from ff77575 to 73115a6 Compare November 10, 2026 10:00

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 17s —— View job


Review of PR #25184 (synchronize at 73115a62)

Verdict: ship. 0 blocking, 0 important, 0 inline findings.

Scope: inspection only. I did not build or run tests. The checkout has no merge base with origin/dev/mazi/findname-namescope, so I could not produce the stack-base diff. I read DependencyObject.Name.cs, the last commit (perf: Drop the VisualState Name caches) and VisualState.cs.

Notes

  • The last commit matches the description. VisualState.Name and VisualStateGroup.Name read GetValue(NameProperty). Only FrameworkElement keeps NameCache, filled by the DP's backing-field callback.
  • NamePropertyHolder is consistent with the description: default "", null coerced to "", and the changed callback forwards to FrameworkElement.OnNameChanged.
  • The PR description's "PR now" allocation table was measured before the cache removal. The author already notes this.

Still open for the author

  • Screenshot-compare checklist item: builds 238886 and 238970 both report 2458 changed Windows screenshots and 118 changed Linux screenshots. The counts are identical across runs and too broad to come from Name handling. Please check whether the baseline is stale.
  • Validation gap noted by @morning4coffe-dev: runtime evidence is Skia desktop only. Consider running Given_DependencyObject_Name, Given_VisualStateManager and Given_FindName_NonFrameworkElement on WASM and one mobile target.
  • Nit: the IsNameVisibleOn comment in DependencyProperty.cs could say plainly which lookups see the DP, parser and Setter versus bindings.
  • The GC.Collect() code-quality comments are on mobile accessibility tests from feat(a11y): add mobile automation support #23935, not this PR.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 13s —— View job


Scope check for PR #25184 (synchronize at 73115a62)

The trigger had no specific request, so I did not run a full review. I did not build or run tests.

I could not produce the stack-base diff. The checkout has no merge base with origin/dev/mazi/findname-namescope. The latest commits (perf: Drop the VisualState Name caches, test: Restore DO Name storage tests for FindName, perf: Skip the Name holder in other DP lookups) match the PR description.

Open items for the author

  • Screenshot compare. The checklist item is still unchecked. Builds 238886 and 238970 both report 2458 changed Windows screenshots and 118 changed Linux screenshots. The counts are identical across runs and look too broad to come from Name handling. Check whether the baseline is stale before ticking it.
  • Validation breadth. morning4coffe-dev's review notes that runtime evidence is Skia desktop only, and that "Uno.UI - CI" was skipping on this PR. Your 238916 run covered more lanes. Confirm that the generator XName snapshot tests and Uno.UI.UnitTests passed at this head.
  • Comment wording. The IsNameVisibleOn comment in DependencyProperty.cs should say which lookups see the Name DP (parser and Setter) and which don't (the binder).
  • GC.Collect() comments. These point at Given_Mobile* and Given_SkiaAndroidAccessibilityNode, which belong to feat(a11y): add mobile automation support #23935 lower in the stack. They aren't part of this PR's diff.

Ask for a specific review or change with @claude if you want one.

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

Labels

7.1 PRs only. For issues, use the Release field. area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure area/code-generation Categorizes an issue or PR as relevant to code generation area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VisualStateGroup.Name and VisualState.Name return null instead of an empty string when unnamed

5 participants