Repository navigation
feat!: Make DependencyObject a class instead of an interface - #23537
Conversation
|
Claude finished @MartinZikmund's task in 8m 7s —— View job Review:
|
| # | Severity | Location | Issue |
|---|---|---|---|
| 1 | Medium | DependencyObject.cs:29 |
_binderTrace field is declared and initialized but never read anywhere in the codebase — dead allocation. Remove it (and the Uno.Diagnostics.Eventing using if it becomes unused). |
| 2 | Medium | DependencyObject.cs:75 |
DataContextChanged event uses TypedEventHandler<FrameworkElement, …> as sender but lives on DependencyObject. OnDataContextChanged invokes this as FrameworkElement, which is null for non-FE DOs (e.g. SetterBase, FlyoutBase, brushes). Pre-existing behaviour from the mixin, but now more visible. Worth a follow-up to either move the event to FrameworkElement (matching WinUI 3) or widen the sender type. |
| 3 | Medium | Generated/…/DependencyObjectCollection.cs:9 |
Hand-editing a Generated/ folder — violates AGENTS.md policy. The change is correct (the updated sync generator will produce the same output), but the file should be regenerated rather than hand-patched to keep the invariant that generated files are generator-owned. |
| 4 | Low | BindableTypeProvidersGenerationTask.cs:504 / DependencyObjectAvailabilityGenerator.cs:143 |
IsDependencyObject helpers end with a GetAllInterfaces().Any(…) fallback that checks for DependencyObject as an interface. This branch can never be true post-PR and is dead code. |
| 5 | Low | DependencyPropertyMixinGenerator.cs:275 |
Comment says "reference/Skia API" but the condition !UNO_REFERENCE_API correctly generates on Skia. The comment conflates Skia with reference API. Suggestion left inline. |
No issues found with: base-type detection in the XAML generator (IsType reuse is correct), LinkerHintGeneratorTask DO walk (early-exit + recursion is correct), where T : class, DependencyObject constraint removals, partial-class base-list reordering (DependencyObject first), ColumnDefinition/RowDefinition/Brush moving from internal void to internal override void, FlyoutBase/SetterBase switching from partial void to override (call ordering is correct — internal sync before base event fire), unit/runtime test where T : class, DependencyObject → where T : DependencyObject cleanup, DependencyObjectStore._parentDataContextProperty fix to reference DependencyObject.DataContextProperty, and Setter<T> double-cast (T)(object) idiom (necessary since T is unconstrained).
WinAppSDK sync generator drift detected on
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23537/wasm-skia-net9/index.html |
|
The build 219597 did not find any UI Test snapshots differences. |
ajpinedam
left a comment
There was a problem hiding this comment.
Agree with Xiaoy comments
f9be820 to
5848a5e
Compare
|
Claude finished @MartinZikmund's task in 7m 11s —— View job Review:
|
| # | Severity | Location | Issue |
|---|---|---|---|
| 1 | Medium | DependencyPropertyMixinGenerator.cs:275–278 |
Comment still inaccurate after the latest fix: says "UNO_REFERENCE_API is defined for Skia, WebAssembly and Reference" — but UNO_REFERENCE_API ≡ __NETSTD_REFERENCE__ (reference stub only, not Skia/WASM). The behavioral change ("true" → "!UNO_REFERENCE_API") is correct; only the explanatory prose needs fixing. Suggestion posted inline. |
| 2 | Low | Canvas.cs:23–41 (OnLeftChanged, OnTopChanged) |
Uses IFrameworkElement parent + explicit (DependencyObject)parent cross-cast to reach InvalidateArrange() via the extension method, while the equivalent Grid.Properties.cs hunk (changed in this same PR) uses FrameworkElement parent for a direct dispatch. The cast is safe but inconsistent; suggestion to use FrameworkElement parent posted inline. |
No new issues found in: DependencyObject.cs member layout (DispatcherQueue init matches old mixin), TemplatedParentProperty registration on DO, LinkerHintGeneratorTask base-type recursion, XamlFileGenerator IsType reuse, ColumnDefinition/RowDefinition/Brush internal override void OnPropertyChanged2, RowDefinition/NativeListViewBase base-class ordering, Control.FindNameInScope cast to (DependencyObject)root, ItemsControlExtensions/FrameworkElementAutomationPeer/EntranceThemeTransition IFrameworkElement→DependencyObject casts (safe; pattern matches always work on types that are both), Setter<T> double-cast (T)(object), and where T : DependencyObject constraint cleanups across tests.
Carry-forward note (not a new finding): The Generated/…/DependencyObjectCollection.cs hand-edit is still present. The sync-generator fix (Generator.cs adds the type to _baseTypeExcludes) means the next automated /apply-sync-gen run will produce byte-identical output, but the file is still technically maintainer-owned rather than generator-owned until that run is committed. The PR description and CI comments already cover this; no new inline comment needed.
🤖 Addressed PR comments up to this pointRebased onto the latest
|
There was a problem hiding this comment.
Pull request overview
This PR performs a breaking refactor to align Uno with WinUI by changing Microsoft.UI.Xaml.DependencyObject from an interface (with per-type generated “mixin” plumbing) into a real base class, and updates generators/call-sites accordingly now that the historical native-target constraint is gone.
Changes:
- Convert
DependencyObjectto a base class that owns theDependencyObjectStore/binder plumbing, instead of relying onDependencyObjectGenerator-injected members. - Update framework code to accommodate
IFrameworkElementno longer inheritingDependencyObject, including updated casts, base-type ordering, overrides, and generic constraints. - Update source generators and the WinAppSDK sync generator to detect
DependencyObjectvia base-type walks; removeDependencyObjectGeneratorand its diagnostics/tests.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.WinAppSDKSyncGenerator/Generator.cs | Prevents sync generator from emitting a conflicting DependencyObject base for DependencyObjectCollection. |
| src/Uno.UI/UI/Xaml/Setter.Generic.cs | Adjusts generic casts after DependencyObject becomes a class. |
| src/Uno.UI/UI/Xaml/Media/Brush.cs | Switches OnPropertyChanged2 to override the new base virtual. |
| src/Uno.UI/UI/Xaml/Media/Animation/EntranceThemeTransition.cs | Updates storyboard target assignment via explicit DependencyObject cast. |
| src/Uno.UI/UI/Xaml/IFrameworkElement.cs | Removes DependencyObject from interface inheritance; updates template-child helper cast. |
| src/Uno.UI/UI/Xaml/DependencyObject.cs | Introduces DependencyObject base class implementation (store, binder hooks, templated parent DP, binding APIs). |
| src/Uno.UI/UI/Xaml/Controls/TextBlock/TextBlock.cs | Reconciles inheritance now that DependencyObject is a base class (derives from FrameworkElement). |
| src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs | Updates generic constraints (where T : DependencyObject). |
| src/Uno.UI/UI/Xaml/Controls/ListViewBase/NativeListViewBase.cs | Makes NativeListViewBase inherit DependencyObject (base class first). |
| src/Uno.UI/UI/Xaml/Controls/ItemsControl/ItemsControlExtensions.cs | Adds cast where IItemsControl is passed where a DependencyObject is required. |
| src/Uno.UI/UI/Xaml/Controls/Grid/RowDefinition.cs | Re-roots inheritance and overrides OnPropertyChanged2. |
| src/Uno.UI/UI/Xaml/Controls/Grid/Grid.Properties.cs | Updates parent pattern/casts after IFrameworkElement change. |
| src/Uno.UI/UI/Xaml/Controls/Grid/ColumnDefinition.cs | Re-roots inheritance and overrides OnPropertyChanged2. |
| src/Uno.UI/UI/Xaml/Controls/Control/Control.cs | Updates template helpers and NameScope access to use DependencyObject casts. |
| src/Uno.UI/UI/Xaml/Controls/Canvas/Canvas.cs | Updates invalidation calls to work with new type relationships (via DependencyObject extension). |
| src/Uno.UI/UI/Xaml/Automation/Peers/FrameworkElementAutomationPeer.cs | Adds explicit DependencyObject cast for automation attached-property APIs. |
| src/Uno.UI/UI/Xaml/AttachedDependencyObject.cs | Removes now-unnecessary binder init call from constructor. |
| src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml/DependencyObjectCollection.cs | Removes explicit DependencyObject base emission from generated stub. |
| src/Uno.UI/Controls/Renderer.cs | Simplifies generic constraint now that DependencyObject is a class. |
| src/Uno.UI.UnitTests/DependencyProperty/Given_DependencyProperty.Type.cs | Updates unit tests to detect DO via IsAssignableFrom instead of interfaces. |
| src/Uno.UI.UnitTests/DependencyProperty/Given_DependencyProperty.Owner.cs | Same DO detection update for owner checks. |
| src/Uno.UI.RuntimeTests/MUX/Utilities/VisualTreeUtils.cs | Simplifies generic constraints to where T : DependencyObject. |
| src/Uno.UI.RuntimeTests/MUX/Utilities/TestHelpers.cs | Simplifies generic constraints to where T : DependencyObject. |
| src/SourceGenerators/Uno.UI.Tasks/LinkerHintsGenerator/LinkerHintGeneratorTask.cs | Updates Cecil-based DO detection to base-type recursion. |
| src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs | Updates DO detection logic used by XAML generation. |
| src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs | Replaces interface checks with base-type checks (IsType). |
| src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyObjectGenerator.Diagnostics.cs | Removes obsolete diagnostic definition (generator retired). |
| src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyObjectGenerator.cs | Removes generator that previously injected DO mixin members. |
| src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/DependencyObjectAvailabilityGenerator.cs | Updates DO detection to walk base-type chain. |
| src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs | Updates DO detection to walk base-type chain. |
| src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyObjectGeneratorTests/Given_DependencyObjectGenerator.cs | Removes tests tied to removed DependencyObjectGenerator. |
| src/SourceGenerators/Uno.UI.SourceGenerators.Internal/Mixins/DependencyPropertyMixinGenerator.cs | Adjusts mixin generation condition for a type that is only DO on some builds. |
| src/SourceGenerators/Uno.UI.SourceGenerators.Internal/DependencyObject/DependencyPropertyGenerator.cs | Updates DO detection to base-type chain for generated DP plumbing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23537/wasm-skia-net9/index.html |
|
The build 220460 did not find any UI Test snapshots differences. |
|
Claude finished @MartinZikmund's task in 4m 5s —— View job Review:
|
| # | Severity | Location | Issue |
|---|---|---|---|
| 1 | Low | DependencyObject.cs:2–8 |
Four unused using directives (System.Collections, System.Collections.Generic, System.Linq, Uno.Disposables) — carried from the old generator mixin, not referenced in this partial file. Will surface as IDE0005 warnings in strict CI builds. |
| 2 | Low | Canvas.cs:23–26, 38–41 |
OnLeftChanged and OnTopChanged use Parent: IFrameworkElement parent + ((DependencyObject)parent).InvalidateArrange(), while Grid.Properties.cs was correctly updated in this PR to use Parent: FrameworkElement parent + parent.InvalidateArrange() directly. The cross-cast is safe in practice but inconsistent and unnecessarily indirect. |
Correction for the carry-forward thread on DependencyPropertyMixinGenerator.cs: The previous automated review (July 2) continued to claim the comment was inaccurate. That finding was itself wrong. Uno.CrossTargetting.targets explicitly documents UNO_REFERENCE_API as "true for Skia, Wasm, and Reference" (while __NETSTD_REFERENCE__ is reference-only). The comment on line 275 stating "UNO_REFERENCE_API is defined for Skia, WebAssembly and Reference" is therefore correct, and @MartinZikmund's response was accurate. No change needed there.
No new issues found in: DependencyPropertyGenerator.cs interface fallback (intentional — explained clearly in the commit message; needed while the released package still ships DependencyObject-as-interface), BindableTypeProvidersGenerationTask and DependencyObjectAvailabilityGenerator DO-detection (clean base-type walk, no dead fallbacks), LinkerHintGeneratorTask (interface fallback correctly removed), DependencyObject.cs class layout, TemplatedParentProperty registration, IFrameworkElement cast sites, RowDefinition/ColumnDefinition/Brush OnPropertyChanged2 overrides, FlyoutBase/SetterBase override ordering, generic constraint cleanups, and DependencyObjectCollection.cs sync-generator fix.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23537/wasm-skia-net9/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23537/wasm-skia-net9/index.html |
|
Claude finished @MartinZikmund's task in 1m 50s —— View job Review:
|
| Finding | Status |
|---|---|
DependencyObject.cs — four unused using directives (System.Collections, System.Collections.Generic, System.Linq, Uno.Disposables) |
✅ Removed |
Canvas.cs OnLeftChanged/OnTopChanged — IFrameworkElement parent + ((DependencyObject)parent) cross-cast |
✅ Now uses FrameworkElement parent + direct parent.InvalidateArrange() |
Additional cleanup noted: OnZIndexChanged was also tightened from (dependencyObject as IFrameworkElement)?.InvalidateArrange() to an explicit if (dependencyObject is IFrameworkElement) { dependencyObject.InvalidateArrange(); } with braces — consistent with the code-style rule (always use braces) and semantically equivalent in practice (all IFrameworkElement implementations are UIElement subclasses, so the extension method resolves to (UIElement)dependencyObject).
No new issues found. The refactor is clean, all prior review threads are addressed, and the PR is ready from an automated-review standpoint.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23537/wasm-skia-net9/index.html |
|
The build 221024 did not find any UI Test snapshots differences. |
74d1d82 to
60d41fb
Compare
|
Claude finished @MartinZikmund's task in 2m 54s —— View job Review:
|
| Finding | Status |
|---|---|
DependencyObject.cs — four unused using directives (System.Collections, System.Collections.Generic, System.Linq, Uno.Disposables) |
✅ Removed in 74d1d820 |
Canvas.cs OnLeftChanged/OnTopChanged — IFrameworkElement parent + ((DependencyObject)parent) cross-cast |
✅ Fixed in 60d41fb0 — now uses FrameworkElement parent + direct parent.InvalidateArrange() |
No new issues found in: DependencyObject.cs class layout and usings; Canvas.cs OnZIndexChanged braces cleanup; DependencyPropertyGenerator.cs IsDependencyObject helper with retained interface fallback (correctly documented — needed while released package still ships DO as interface); BindableTypeProvidersGenerationTask / DependencyObjectAvailabilityGenerator clean base-type walks; LinkerHintGeneratorTask self-check before recursion; UIViewExtensions.cs (object?)view as DependencyObject cross-hierarchy cast; PackageDiffIgnore.xml regex entries for all 22 relocated members; Grid.Properties.cs FrameworkElement parent pattern; ColumnDefinition/RowDefinition/Brush internal override void OnPropertyChanged2; Setter<T> (T)(object) double-cast (required for unconstrained generic); where T : DependencyObject constraint cleanups; IFrameworkElement DependencyObject removal and cast fixes.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23537/wasm-skia-net9/index.html |
|
The build 221056 found UI Test snapshots differences: Details
|
Prepares the generators for DependencyObject becoming a class instead of an interface (BC26): interface-membership checks (AllInterfaces / GetAllInterfaces) no longer find a base class, so route DependencyObject detection through base-type walks. Also stop the WinAppSDK sync generator from emitting DependencyObject as an explicit base (it is the universal root, always provided by the hand-written partial), and gate the ItemsWrapGridLayout mixin to the non-reference build where it is a DO. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01V1DDwHqUPDocBBHeu1YX3Z
BC26 (uno-private #2055). The interface only ever existed because native mobile UIElement had to inherit a native view; with the native targets dropped, DependencyObject becomes a normal base class as in WinUI. The per-type mixin the DependencyObjectGenerator used to inject (store, GetValue/SetValue, binder, DataContext/TemplatedParent, IWeakReference Provider, IDependencyObjectInternal, ToString, [Bindable]) now lives once on the DependencyObject base class. DataContextProperty and Templated ParentProperty are registered a single time on the base (ownerType = DependencyObject) rather than per type; the store keeps using them unchanged (the DependencyObjectStore itself is untouched - that is a later phase). The generator and its diagnostics/tests are removed. Re-rooting and consumer fixes: - IFrameworkElement no longer extends DependencyObject (an interface can no longer inherit the class); call sites that used IFrameworkElement as a DependencyObject now cast. - Shared partials that declared ": DependencyObject" while a platform partial declared the real base (TextBlock) or that listed it after an interface (RowDefinition, ColumnDefinition, NativeListViewBase) are reconciled so the base class comes first / only once. - "where T : class, DependencyObject" constraints drop the now-illegal class constraint. - FlyoutBase/SetterBase OnDataContextChangedPartial and RowDefinition/ ColumnDefinition/Brush OnPropertyChanged2 become overrides of the base virtuals. Builds clean on Skia (net10.0). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01V1DDwHqUPDocBBHeu1YX3Z
The blanket skip added while flipping DependencyObject to a class dropped the DependencyObject base from every sync-generated stub, but only the DependencyObjectCollection stub was updated to match, so regeneration diverged from the other committed stubs (AutomationPeer, ColumnDefinition, …) and the WinAppSDK Sync Generator Check failed. DependencyObjectCollection derives from DependencyObjectCollection<DependencyObject> in the hand-written partial (which carries the DependencyObject base and the IList implementation), so only its metadata base must be suppressed. Move it into the existing _skipBaseTypes mismatched-hierarchy list and let every other type keep emitting its DependencyObject base. Addresses review threads on DependencyObjectCollection base (it still derives from DependencyObject, transitively, as a class). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016g1Lvg4ET5pPXX5fdWT7TB
Now that DependencyObject is a class it can never appear in a type's interface list, so the interface fallbacks in the DO-detection helpers are dead. Drop them (BindableTypeProvidersGenerationTask, DependencyObjectAvailabilityGenerator, LinkerHintGeneratorTask) and extract the base-chain walk in DependencyPropertyGenerator into a shared IsDependencyObject helper mirroring the other generators. Also clarify the ItemsWrapGridLayout mixin comment: UNO_REFERENCE_API is defined for Skia, WebAssembly and Reference (Uno.CrossTargetting.targets), so the mixin is emitted only for the native (!UNO_REFERENCE_API) build. Addresses review comments on the generator DO-detection helpers. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016g1Lvg4ET5pPXX5fdWT7TB
- DependencyObject: remove the unused _binderTrace field (and its Uno.Diagnostics.Eventing using) and shorten the fully-qualified member signatures by importing the relevant namespaces. - Grid: invalidate the parent's measure through the FrameworkElement instance method instead of the DependencyObject extension, matching the distinct IFrameworkElement/DependencyObject implementations. - TextBlock: declare the FrameworkElement base on the shared partial for parity with the platform partials. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016g1Lvg4ET5pPXX5fdWT7TB
The DependencyPropertyGenerator tests compile `class C : DependencyObject` against the released Uno package (WithUnoPackage), where DependencyObject is still an interface, so base-chain-only detection missed those types and the golden tests (TestInDependencyObject, TestGetDefaultValuePresentWithDefaultValueArgument) regressed. Restore the implemented-interface match inside the extracted helper; it becomes removable once a stable release ships DependencyObject-as-class. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016g1Lvg4ET5pPXX5fdWT7TB
With DependencyObject now a class (not an interface), `view as DependencyObject` on a UIKit.UIView no longer compiles (CS0039 — no reference conversion exists), which broke the AppleUIKit Skia head build. Route the cast through object so it compiles and preserves the runtime check (non-null only if the view actually is a DependencyObject). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016g1Lvg4ET5pPXX5fdWT7TB
DependencyObject is now a base class (BC26). The store, binder and TemplatedParent members that the DependencyObjectGenerator used to emit on every type are now inherited from the base, so the API diff reports them as "removed" on ~100 previously-declaring types. They remain available (inherited). Add regex ignore entries covering the 22 relocated method signatures (plus the five property-backed members) across all types, alongside the BC58 DataContext entries in the same baseline ignore set. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016g1Lvg4ET5pPXX5fdWT7TB
- Canvas Left/Top handlers match on FrameworkElement and call InvalidateArrange() directly, matching Grid.Properties.cs and dropping the (DependencyObject) cross-cast. - Remove four unused usings from DependencyObject.cs. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01PYb2VuYxKqicfJRcXkdDVv
60d41fb to
f6f222d
Compare
|
Claude finished @MartinZikmund's task in 7m 9s —— View job Review:
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23537/wasm-skia-net9/index.html |
|
The build 221237 found UI Test snapshots differences: Details
|
|
|
GitHub Issue: Closes #17099 · Closes unoplatform/uno-private#2055 —
DependencyObjectshould be a class. Part of the breaking-changes rollup (epic #8339).PR Type:
🔄 Refactoring · 💬 Breaking change (
feat!)What changed? 🚀
On the historical native targets,
Microsoft.UI.Xaml.DependencyObjectwas a C# interface whose implementation was injected per-type byDependencyObjectGenerator— a workaround forced byUIElementhaving to inherit native view base classes (AndroidView, iOSUIView). With the native targets dropped (#23470) that constraint is gone, soDependencyObjectbecomes a normal base class, exactly as in WinUI.This is Phase 1: make
DependencyObjecta class and retire the generator mixin, while keepingDependencyObjectStoreas-is. Dissolving the store intoDependencyObjectis a deliberate later phase.Changed ✏️
DependencyObjectis now apublic partial class. Everything the generator used to stamp into every DO type now lives once on the base class: the__Storeaccessor,GetValue/SetValue/ClearValue/ReadLocalValue/GetAnimationBaseValue/Register|UnregisterPropertyChangedCallback,Dispatcher/DispatcherQueue, the binder (SetBinding/SetBindingValue/GetBindingExpression/Resume|SuspendBindings/Clear|RestoreBindings),DataContext/TemplatedParent+ theDataContextChangedevent,IWeakReferenceProvider,IDependencyObjectStoreProvider,IDependencyObjectInternal.OnPropertyChanged2, andToString.DataContextProperty/TemplatedParentPropertyare registered a single time onDependencyObject(ownerDependencyObject) instead of once per type. The store keeps consuming them unchanged — this is behaviorally equivalent: with a single shared DP,_dataContextProperty == _parentDataContextProperty, and every inheritance/precedence/UniqueIdcomparison inDependencyObjectStorestill holds (per-type metadata still resolves viaGetMetadata(forType)).Removed 🗑️
DependencyObjectGenerator+ itsUno0003diagnostic + golden test. With DO as a class no type needs the injected mixin, and[Bindable]is inherited from the base (the bindable-metadata/linker scans already walk the base chain viaGetAllAttributes).Re-rooting & consumer fixes
IFrameworkElementno longer extendsDependencyObject(a C# interface can't inherit a class). The ~handful of call sites that treated anIFrameworkElementas aDependencyObjectnow cast.: DependencyObjectwhile a platform partial declared the real base (TextBlock), or that listed it after an interface (RowDefinition,ColumnDefinition,NativeListViewBase), are reconciled so the base class comes first / only once.where T : class, DependencyObjectconstraints drop the now-illegalclassconstraint.FlyoutBase/SetterBaseOnDataContextChangedPartialandRowDefinition/ColumnDefinition/BrushOnPropertyChanged2become overrides of the base virtuals.AllInterfaces/GetAllInterfaces/ImplementedInterfaces, which no longer find a base class) to base-type walks: the XAML generator, the[GeneratedDependencyProperty]generator, the bindable-availability + linker-hint generators (incl. the Cecil-basedLinkerHintGeneratorTask), and the DP-mixin generator. The WinAppSDK sync generator no longer emitsDependencyObjectas an explicit base (it is the universal root, always provided by the hand-written partial).Validation
Uno.UI.Skia,SamplesApp.Skia.GenericRelease,Uno.UI.RuntimeTests.Skia) and the unit-test flavor.When_Gregorian_FixedDatefailures are pre-existing timezone-sensitiveWindows.Globalizationtests (inUno.UWP, untouched by this PR).Given_ContentControl/Given_DependencyObjectCollection/Given_DependencyObjectExtensions/Given_ToolTip/Given_Stylecanaries all green. The 7Given_Flyout.Check_Placement_All_*"beyond-edge" failures reproduce identically on the base commit, so they are pre-existing window-geometry-dependent failures in the local headless host, unrelated to this change.PR Checklist ✅
Screenshots Compare Test Runresults.Breaking change
DependencyObjectchanges from an interface to a class (source & binary breaking). Realistic impact for a typical app is narrow — usingDependencyObjectas a base, parameter, or return type behaves identically. Code that breaks:DependencyObjectinterface on a class with another base, or relied on interface-style multiple inheritance → must now inherit theDependencyObjectclass.DependencyObject→ can no longer (an interface can't inherit a class); re-shape them or cast.Type.GetInterfaces()/ RoslynAllInterfaces) → switch to base-type checks (IsAssignableFrom/ base-type walks).where T : class, DependencyObjectconstraints → dropclass.This targets the
feature/breakingchanges7.0 base, where breaking changes are expected.🤖 Generated with Claude Code