Skip to content

Theming (animations) - #23491

Open
MartinZikmund wants to merge 24 commits into
masterfrom
dev/mazi/notifyanims
Open

MartinZikmund wants to merge 24 commits into
masterfrom
dev/mazi/notifyanims

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #

PR Type:

What changed? 🚀

PR Checklist ✅

@github-actions

github-actions Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

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


PR Review: Theming (animations)

  • Gather context and understand the PR scope
  • Review core theming changes (DependencyObjectStore.Theming.cs, FrameworkElement.Theming.cs)
  • Review new files (FrameworkTheming.cs, CoreServices.Theming.cs, ThemeResolution.cs)
  • Review ResourceDictionary.cs and ResourceResolver.cs changes
  • Review Application.cs and related changes
  • Review test coverage
  • Post inline comments and summary

Overall Verdict

This is a substantial, high-quality WinUI port. The code is well-structured, follows the MUX reference discipline (// MUX Reference: attributions throughout), and includes strong test coverage (3 large new runtime-test files, 2 new unit-test files). The broad approach — per-DO _theme on DependencyObjectStore, FrameworkTheming state machine, CoreServices.Theming.cs, ThemeResolution, and the three-phase UpdateResourceBindings orchestrator — is architecturally sound and faithful to the WinUI model.

Issues: 2 medium, 4 low

Medium — performance/GC pressure:

  • FrameworkTheming.cs:217 — colorKeyStorage, brushKeyStorage, and overrideAlphaValues are compile-time constant arrays re-allocated on every theme change. They should be static readonly fields. Only colorValues (dynamic, derived from IThemingInterop calls) must remain local. This removes 3 allocations + GC roots per OS/app theme switch.

  • DependencyObjectStore.Theming.cs:800 — The GetOwnerTheme() local function captures reference-typed ActualInstance and resourceContextProvider, causing a heap-allocated closure per UpdateResourceBindings call. This method is the per-element choke point for the entire visual tree on every theme change (O(tree-size) call frequency). Prefer computing ownerTheme eagerly and passing it down.

Low — correctness/style:

  • FrameworkTheming.cs:24 — public delegate void NotifyThemeChangedFunc() inside an internal sealed class. Has no external-visibility effect (everything is internal), but is inconsistent with codebase conventions. Either mark internal or use Action directly as the field type.

  • DependencyObjectStore.PropertySystem.mux.cs:215 — property.Name == "ItemsSource" string comparison silently excludes any DP named "ItemsSource", including custom/third-party ones. Prefer explicit DependencyProperty references, or at minimum document the scope of the exclusion.

  • ResourceDictionary.cs:845 — EnsureActiveThemeDictionary triggers NotifyThemeChanged as a side effect of what reads as an "ensure/get" call. Faithful to WinUI, but surprising for Uno contributors not familiar with WinUI internals. Worth a doc note so debuggers can trace unexpected theme walks back to this point.

  • SystemThemingInterop.cs:79 — 0xFFAABBCC hardcoded fallback for GetSystemColor will render a conspicuous teal/blue color in high-contrast mode. No issue number is referenced. Consider adding a tracked issue reference or a runtime LogLevel.Warning log so high-contrast regressions surface in logs before the implementation is complete.

Cross-cutting notes

  • The IsDependencyPropertyBackReference list (Theming.cpp port) is intentionally incomplete — FlyoutBase_Target, Control_FocusTargetDescendant, etc. are documented as TODOs. This is acceptable for the current phase but means edge-case theme propagation up the tree remains possible on those properties.
  • The #if UNO_HAS_ENHANCED_LIFECYCLE try / #if … finally pattern in FrameworkElement.Theming.cs:529–562 is clever (shares the body between both targets without duplication) but is hard to follow in static analysis and may confuse static-analysis tooling.
  • Test coverage is comprehensive for a change of this scope. The Given_Theme_Materialization.cs runtime test (1379 lines), Given_ElementTheme_Resolution_Regression.cs, and Given_CheckBox_ThemeResource_Regression.cs together cover the key invariants.

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/notifyanims branch from 1eb43a0 to bcc8191 Compare June 18, 2026 08:46
@github-actions

github-actions Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 7m 0s —— View job


PR Review: Theming (animations) — Incremental Update

  • Load tools
  • Gather diff (7 new commits since last review)
  • Review changed files
  • Post inline comments
  • Update summary

Scope of this review

7 new commits since the previous review:

Commit Change
bd894103 fix: re-apply color keyframe value on theme change
54b2844f test: re-enable cached-page test on NativeWinUI
044ebd3f fix: establish theme on lazy VisualState chain, drop band-aid
6cac2050 fix: gate app-override on exact IsGlobalThemeDictionaries
5e14bb64 fix: don't let resource rebind defeat animation
6ec52d0c test: guard CheckBox themeresource re-resolution
bcc81913 docs: cite WinUI modifier-being-set gate in fix comment

Overall verdict

These incremental fixes are high quality. The three layered approaches — (1) correct IsGlobal/IsGlobalThemeDictionaries to replace the preferAppResourceOverride workaround, (2) SuppressLocalCanDefeatAnimations wrap around UpdateResourceBindings to prevent the animation-defeat bug, and (3) NotifyThemeChanged(forceRefresh: true) on the lazily-built VisualState chain — together form a coherent root-cause fix rather than stacking guards. The removal of EnsureKeyFrameThemeResources and the preferAppResourceOverride parameter clean up the previous band-aid approach. Test coverage in Given_Theme_Materialization.cs and Given_CheckBox_ThemeResource_Regression.cs is comprehensive.

Issues: 1 low

  • ColorAnimationUsingKeyFrames.cs:432 — State != TimelineState.Stopped covers both Active and Filling. For Active animations (still ticking), SetValue(_finalValue) snaps to the final color for one frame before the IValueAnimator callback restores the correct interpolated value on the next tick. This is harmless for the common 0-duration discrete template keyframe (the Active → Filling transition is instantaneous). For a continuous multi-keyframe animation mid-run during a theme switch, there is a single-frame visual artifact. ObjectAnimationUsingKeyFrames.OnThemeChanged avoids this by applying _currentFrame.Value (the current frame, not the final) — there's no equivalent for color interpolation, so the Active path is approximate. Low severity; worth a short comment explaining the intent.

Cross-cutting notes

  • IsGlobalThemeDictionaries vs IsSystemDictionary: IsGlobal = true is now set for _isUnoAssembly || _isUnoFluentAssembly, while IsSystemDictionary remains Uno-only. This is correct: FluentTheme dictionaries should be overridable by app resources (matching WinUI's m_isGlobal behavior), but FluentTheme was previously excluded from the IsSystemDictionary path. The broadened scope is a correct behavioral alignment with WinUI.
  • SuppressLocalCanDefeatAnimations scope: The static counter on ModifiedValue makes the suppress global-to-UI-thread. Nested UpdateResourceBindings calls (property-change callbacks that re-trigger resolution) will also be suppressed. This is intentional (the comment calls it out explicitly) and nests safely under the existing global guard in CoreServices.RaiseThemeChanged.
  • VisualState.cs forceRefresh: true: Necessary because newly-built DOs start with _theme == Theme.None. Without forceRefresh, a child with _theme == None and ambient owner theme None would satisfy theme == _theme and skip the walk. The force-flag correctly bootstraps the chain on first materialization.
  • The previous review's medium-severity closure-allocation finding on GetOwnerTheme() (now in UpdateResourceBindingsCore) remains open — the local function still captures ActualInstance and resourceContextProvider via a heap-allocated closure.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation labels Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 5m 45s —— View job


PR Review: Theming (animations) — Incremental Update

  • Load tools
  • Gather diff (3 new commits since last review)
  • Review fc29f7e1 — perf: pack store flags into a flags enum
  • Review bfa245fc — fix: re-resolve on high-contrast toggle
  • Review 58ed42cf — docs: reconcile audit spec
  • Post inline comments
  • Update summary

Scope of this review

3 new commits since the previous review:

Commit Change
58ed42cf docs: reconcile audit spec; fix stale citations
fc29f7e1 perf: pack store flags into a flags enum
bfa245fc fix: re-resolve on high-contrast toggle

Overall verdict

All three commits are clean. No new bugs found.

fc29f7e1 — StoreFlags packing: The five bool fields (_isProcessingThemeWalk, _walkForceRefresh, _isUpdatingChildResourceBindings, _isProcessingEnterLeave, _isActive) are correctly consolidated into a single StoreFlags : byte bitfield. The GetFlag/SetFlag helpers are correct — _flags &= ~flag on a byte-backed enum correctly computes (byte)(0xFF ^ mask). The comment on line 69 ("members below are only written on enhanced-lifecycle targets") is accurate: WalkForceRefresh, IsProcessingEnterLeave, and IsActive are only set inside UNO_HAS_ENHANCED_LIFECYCLE-gated blocks. The partial-class scope allows all three .cs files to access the private enum and helpers.

bfa245fc — HC toggle wiring: The HighContrastChanged event in SystemThemeHelper follows the same pattern as SystemThemeChanged (bare static field, custom accessors) — consistent. The ClearNonDefaultAlcHandlers refactoring to RemoveNonDefaultAlcHandlers is correct: modifying the local handler copy and returning it is the right pattern for immutable multicast delegates. The ResourceDictionary.cs change correctly reads the FrameworkTheming snapshot (refreshed by OnThemeChanged) on enhanced-lifecycle targets rather than the live flag, preventing stale HC state during a walk. The new test When_HighContrast_Toggled_After_Load_ReResolves is well-structured: [RunsOnUIThread] at the class level covers it, the finally block restores both HighContrast and WindowContent, and it validates the full round-trip (HC ON → re-resolves to HighContrast dict → HC OFF → re-resolves back to Light).

58ed42cf — docs: Pure spec citation corrections. No code changes.

Cross-cutting notes

  • The previous review's medium-severity GetOwnerTheme() closure-allocation finding (DependencyObjectStore.Theming.cs:829-831) remains open — the local function still captures ActualInstance and resourceContextProvider, generating a heap-allocated closure per UpdateResourceBindingsCore call. No change in these commits.
  • The [global::System.Flags] prefix on the StoreFlags enum is unusual (most codebase usage is bare [Flags]) but harmless. Low severity; not worth a blocking comment.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

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

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/notifyanims branch from 58ed42c to 6dd7404 Compare July 13, 2026 11:34
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

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


PR Review: Theming (animations) — Incremental Update

  • Load tools
  • Gather diff (no new commits since last review; full re-review pass on all 20 changed files)
  • Review changed files
  • Post inline comments
  • Update summary

Scope of this review

No new commits since the previous round — this is a full re-review pass of all 20 changed files to ensure nothing was missed.

Overall verdict

The PR remains high quality. The StoreFlags consolidation, IsGlobal/IsGlobalThemeDictionaries gating, SuppressLocalCanDefeatAnimations wrap, HighContrastChanged wiring, and lazy-VisualState theme bootstrapping are all correct. No new bugs found on this pass.

New issue: 1 low

Low — policy:

  • Given_CheckBox_ThemeResource_Regression.cs:268 (also line 533 in the same file and Given_Theme_Materialization.cs:1326) — Three kahua-private#491 references added in new test comments, in direct contradiction of the PR's own audit spec: findings.md A4-9 identifies the pattern as a policy violation and plan.md A4-9 schedules removal. The public issue #23472 (already present in the adjacent [GitHubWorkItem] attributes) is sufficient.

Remaining open from prior reviews

  • Medium — DependencyObjectStore.Theming.cs:832–834 GetOwnerTheme() local function still generates a heap-allocated closure (captures ActualInstance + resourceContextProvider). O(tree-size) allocation per theme switch. Inline comment was posted in Round 1 and re-confirmed in Round 2; no change in this round.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 4m 56s —— View job


PR Review: Theming (animations) — Incremental Update

  • Load tools
  • Gather diff (3 new commits since last review)
  • Review 6dd74043 — docs: reconcile audit spec; fix stale citations
  • Review 351a0649 — perf: hoist color/brush key tables to static readonly
  • Review 701b3ce0 — docs: clarify walk side effects; drop private issue refs
  • Post inline comments
  • Update summary

Scope of this review

3 new commits since the previous round (full re-review on 2026-07-13):

Commit Change
6dd74043 docs: reconcile audit spec; fix stale citations; migrate IsResourceDictionaryItem to shared _flags field
351a0649 perf: hoist color/brush key tables to static readonly
701b3ce0 docs: clarify walk side effects; drop private issue refs

Overall verdict

All three commits are clean. No new issues found. All findings from prior review rounds have been addressed:

Finding (prior rounds) Severity Resolution
colorKeyStorage, brushKeyStorage, overrideAlphaValues re-allocated on every theme rebuild Medium ✅ Fixed: static readonly fields (351a0649)
GetOwnerTheme() closure allocation concern Medium ✅ Resolved: comment explains the Roslyn struct-closure optimization applies (local function never converted to delegate → by-ref struct, no heap allocation) (701b3ce0)
NotifyThemeChangedFunc public in internal sealed class Low ✅ Fixed: now internal (351a0649)
property.Name == "ItemsSource" fragile name match Low ✅ Documented with rationale and follow-up path (701b3ce0)
EnsureActiveThemeDictionary undocumented NotifyThemeChanged side effect Low ✅ Doc comment added (701b3ce0)
0xFFAABBCC HC placeholder with no issue ref Low ✅ Issue #22965 cited; no-warn rationale noted (701b3ce0)
ColorAnimationUsingKeyFrames.cs Active-state re-apply intent unclear Low ✅ Comment explains transient snap + follow-up path (701b3ce0)
kahua-private#491 private refs in test comments Low (policy) ✅ Removed; #23472 remains (701b3ce0)

Cross-cutting notes on 6dd74043

  • IsResourceDictionaryItem migration: The _storeFlags field and inline StoreFlags enum from DependencyObjectStore.cs are correctly consolidated into _flags (partial in DependencyObjectStore.Theming.cs), assigned bit 5 to avoid any conflict with the existing 5 flags (IsProcessingThemeWalk through IsActive). The GetFlag/SetFlag helpers on the shared field work correctly across partial files.
  • Spec corrections: xcpcore.cpp:8132 → 7905 and corep.h:2207 → 2144 citation corrections are accurate housekeeping.

@MartinZikmund

Copy link
Copy Markdown
Member Author

@comment.md

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

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

Copilot AI lite review requested due to automatic review settings August 19, 2026 15:04
MartinZikmund and others added 11 commits October 3, 2026 10:49
A VisualState Setter's {ThemeResource} was resolved against, and registered
on, the setter's TARGET. When the same visual state also applied a
RequestedTheme boundary to that target — as ComboBoxTextBoxStyle and the
NumberBox template both do, setting ContentElement.RequestedTheme=Light
alongside ContentElement.Foreground — the value re-resolved under that
boundary and produced a near-black foreground in dark theme.

WinUI keeps the setter's live theme binding on the CSetter itself
(ThemeResource.cpp:194-203), resolves it under the setter's own theme
(SetThemeResourceBinding, Theming.cpp:415-424), and hands the target an
already-resolved value (VisualStateSetterHelper.cpp:186), so the target's
RequestedTheme never participates.

Uno keeps the reference registered on the target so the existing
re-application path can reach it, and pins the setter-side resolution owner
(the element owning the VisualStateGroups) on the reference instead. Both
re-resolution sites honour the pin. Mid-walk the pinned owner's persisted
theme is the pre-switch one — WinUI persists m_theme only once the subtree
completes (Theming.cpp:153-156) — so the in-flight walk theme is used there,
which keeps an owner-driven theme change re-applying its active setters.

Verified against a native WinUI oracle (WinAppSDK 2.1.3): focused editable
ComboBox in a dark subtree now reports ContentElement.ActualTheme=Light with
Foreground=#FFFFFFFF, matching WinUI exactly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
Every MUX citation on this branch is pinned to microsoft-ui-xaml2 commit
fc2f82117, as the file headers declare. The local checkout sits on a later
commit (bac7a9c33) where the tree dropped the src/ prefix and framework.cpp,
Theming.cpp, depends.cpp, corep.h and xcpcore.cpp all shifted, so citations
derived from the working tree rather than the pin drifted.

Corrected against `git show fc2f82117:src/dxaml/...`:
  xcpcore.cpp   7905      -> 8132       (SetSubTreeTheme; 7905 is inside
                                         CCoreServices::SetFocusVisualKindIsReveal)
  corep.h       2144      -> 2205-2206  (m_spTheming; 2144 is InitWaitForIdleEvents)
  framework.cpp 3399-3418 -> 3284-3304  (GetRequestedThemeOverride)
  depends.cpp   1023-1048 -> 1044-1069  (the theme block of EnterImpl, which
                                         itself starts at 971)
  Theming.cpp   415-424   -> 367-379    (the SetThemeResourceBinding slot push;
                                         the file is 403 lines at the pin)
  ThemeResource.cpp 194-203 -> 189-198  (the Style-setter vs VSM-setter branch)

The last two are from the preceding setter-side commit, which cited the
working tree rather than the pin.

Comments only; no behaviour change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
WinUI's CFrameworkElement::NotifyThemeChangedForInheritedProperties bails
BEFORE the freeze/unfreeze split: the goto Cleanup at framework.cpp:3423-3429
(@ fc2f82117) jumps over both SetFreezeForeground(true) at :3460 and
SetFreezeForeground(false) at :3476, so on bail the function writes nothing
at all.

Uno instead computed a skipSetValue flag inside the freeze branch and fell
through: it still wrote _themeForeground and _isForegroundFrozen and skipped
only the DP write. A themed boundary that already carried its own Foreground
therefore published the Light DefaultTextForegroundThemeBrush to its whole
subtree. That is the NumberBox and editable ComboBox Focused state, which
sets ContentElement.Foreground and ContentElement.RequestedTheme=Light on the
same ScrollViewer: the inner TextBox's display block inherits Foreground and
so rendered near-black in dark theme (#24021).

The predicate maps exactly. HasLocalOrModifierValue is !(IsPropertyDefault ||
IsPropertySetByStyle) (PropertySystem.cpp:319-324) and BaseValueSourceStyle
calls SetPropertyIsLocal before SetIsSetByStyle (:2951-2956), so the whole
expression collapses to !IsPropertyDefault. An inherited value leaves
IsPropertyDefault true, which is why Uno maps both DefaultValue and
Inheritance to "default".

No compensating write is added on the bail. WinUI needs none because its
freeze brush and the element's own Foreground share one storage slot
(TextFormatting::m_pForeground); in Uno the equivalent fallback for children
is plain DP inheritance of the element's own Foreground.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
Uno materializes a VisualState's Storyboard/Setters lazily, outside the Enter
walk, then establishes the chain's per-object theme itself. That read used
ResolveOwnerTheme, which returns the owner's PERSISTED theme — and during a
theme walk that is still the pre-switch one, because the new theme is
persisted only after NotifyThemeChangedCore returns for the whole subtree
(Theming.cpp:153-156). A state materialized from inside a walk therefore
stamped its keyframes with the old theme.

Switches to ResolvePinnedOwnerTheme, which substitutes the owner's in-flight
walk theme while it is mid-walk — the same pinning the VSM setter path
already uses. Also adds a groups-owner fallback for VisualStateGroups
declared outside a ControlTemplate, where there is no templated parent at all
(MUX: the collection hangs off the element carrying the attached property,
CVisualStateManager2.cpp:345-354, :464).

Templated parent stays primary so the keyframes resolve under the same owner
the state's Setters do: VisualStateManager passes the Control into
VisualStateGroup.GoToState, which is what Setter.ApplyValue then receives.
Making the groups owner primary would split that agreement for any template
whose root part carries its own RequestedTheme.

Validation: the 219-test theming/VisualState/ToggleSwitch suite stays green
apart from two pre-existing failures. No discriminating regression test —
the observable trigger (materializing a state from inside a theme walk) could
not be reproduced in the runtime-test harness; the added test is a coverage
guard that passes both with and without the change, as its comment states.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
WinUI keeps a re-applied theme value from defeating a held animation with a
PER-PROPERTY gate, not a global suppression. SetThemeResourceBinding arms
pModifiedValue->SetModifierValueBeingSet(true) when the property HasModifiers,
released by a scope_exit (Theming.cpp:355-362 @ fc2f82117), and SetValue reads
!IsModifierValueBeingSet() and SKIPS the hardcoded
SetBaseValue(.., BaseValueSourceLocal) entirely (PropertySystem.cpp:1649-1652)
— the call that would otherwise OR in fvsLocalValueNewerThanAnimatedValue
(ModifiedValue.cpp:206-209) and let the base win at GetEffectiveValue.

Uno approximated this with a process-wide static counter wrapped around
UpdateResourceBindings, which missed the Enter walk entirely (Enter reaches
UpdateAllThemeReferences without going through UpdateResourceBindings) and,
while armed, changed the precedence outcome of every SetValue on every object
in the process — including user code running inside theme-walk callbacks.

Ports the gate: HasModifiers and IsModifierValueBeingSet on ModifiedValue,
armed by a scope struct around the value application in UpdateThemeReference
and in the Phase-2 resource-binding fallback. Uno still refreshes _baseValue
under the gate, because WinUI can skip the write only thanks to m_baseValue
holding the live CThemeResource, re-resolved on read; Uno stores the resolved
snapshot, which would otherwise freeze at the pre-change theme once the
animation is cleared.

The pass-level counter is dropped from UpdateResourceBindings, now subsumed.
Its two remaining call sites (the global theme-switch wrappers in
CoreServices and Application) encode a separate concern and are left for a
follow-up.

Validation: proven load-bearing — neutering the gate with the counter already
removed makes When_ThemeResource_Reresolution_Does_Not_Defeat_Active_Animation
fail with the resolved base (#FF00AA44) instead of the held accent
(#FF0062A9); restoring it passes. Uno.UI.UnitTests 4055/4090 (the 12 failures
are timezone-dependent Gregorian calendar tests, unrelated), incl. all 33
Given_ThemeResource tests. Runtime: 472/478 across theming, VisualState,
animation and control suites; all 6 failures pre-existing or order-dependent
flakes that pass in isolation.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
7.0 dissolved DependencyObjectStore into DependencyObject and removed
IDependencyObjectStoreProvider, so the call sites this branch introduces
(ThemeResolution.ResolvePinnedOwnerTheme, VisualState.EnsureMaterialized and the
Given_Theme_Materialization resource-binding helpers) no longer compile as written.
Call the members straight on the DependencyObject instead - same behaviour, no
behavioural change to the retargeted work.

Uno.UI (net10.0) and Uno.UI.RuntimeTests.Skia (net10.0) both build clean.
src/Uno.UI is Skia-only on 7.0 (plain net10.0;net11.0, UnoRuntimeIdentifier=Skia),
so UNO_HAS_ENHANCED_LIFECYCLE is always defined there. Inline the two
#if UNO_HAS_ENHANCED_LIFECYCLE arms this branch introduces - the mid-walk theme pin in
ThemeResolution.ResolvePinnedOwnerTheme and the lazy VisualState theme establishment in
VisualState.EnsureMaterialized (whose #else UpdateResourceBindings fallback is dead) -
and drop the directives. Scoped strictly to the arms this branch adds; the pre-existing
guards in ResourceDictionary/FrameworkElement are left to the repo-wide sweep.
The T6e cached-page test was re-enabled on NativeWinUI in 19ebcd0 on the
strength of a hand validation against a real WinUI 3 app. The behavior claim
holds, but the test still cannot run in the WinAppSDK harness: its probe pages
are code-only Page subclasses, so the app's XamlTypeInfo has no entry for them.

WinUI then resolves the type through ImportUnknownClassInfo, which builds a
CCustomClassInfo with a null backing IXamlType, and ActivationAPI::ActivateInstance
calls GetXamlTypeNoRef()->ActivateInstance() through it unguarded — a null vtable
dereference that faults the process with 0xC0000005. The run produces no results
file, so the whole WinAppSDK job fails rather than a single test.

Restore the exclusion to match its two siblings, and record the actual mechanism
in all three comments so the reasoning is not re-litigated.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AzsBupsJWXqZrc35HZUfce
A theme change re-applied the final keyframe to every non-Stopped color
animation, so a paused one jumped to its endpoint. WinUI keeps the paused
clock and recomputes at the retained progress; limit the re-apply to Active
and Filling.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With no established owner theme, the pinned VisualState setter fell back to
the requested-theme-for-subtree slot, which mid-boundary carries the very
theme the pin escapes. Restores the never-switched-theme case master
covered (When_Editable_ComboBox_Focused_In_Dark_Theme_Without_Theme_Walk).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings October 3, 2026 08:49

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.

@@ -0,0 +1,129 @@
# Theming WinUI Alignment — Audit Findings & Remaining Work
// Pin the setter-side resolution owner so a later re-resolution keeps resolving
// under it rather than under the target's own RequestedTheme.
ResolutionOwner = setterOwner,
};
provider.SetThemeResource(property, themeRef);
Copilot AI lite review requested due to automatic review settings October 3, 2026 09:07
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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


PR Review: Theming (animations) — Incremental Update

  • Load tools
  • Check for new commits since the last review round (2026-09-25)
  • Verify current state of all previously-flagged findings
  • Post inline comment for the one still-open finding
  • Update summary

Scope of this review

HEAD is 89668bfa (fix(theming): pin setter theme to app base when owner unset) — the same logical commit already reviewed in the two prior rounds (2026-09-24 and 2026-09-25; the hash differs only because the branch was rebased onto current master, confirmed by identical subject/content). No new commits have landed since then, so this pass re-verifies the current file state rather than reviewing new code.

Status of previously-flagged findings

Finding Status
Stale "Uno has no such gate" comment (DependencyObject.Theming.cs) ✅ Confirmed fixed
Paused color animation jumping to the endpoint (ColorAnimationUsingKeyFrames.cs:425) ✅ Confirmed fixed as a stopgap (State is TimelineState.Active or TimelineState.Filling); recomputing at the retained paused progress remains a documented follow-up
[global::System.Flags] / nullable setterOwner (Copilot) Not an issue — confirmed correct as-is per Martin's replies
ThemeResolution.cs:53 — ResolvePinnedOwnerTheme's no-established-theme fallback calls CoreServices.Instance directly instead of guarding with CoreServices.HasInstance first Still open — re-posted inline. Verified the HasInstance guard convention is still consistently used at the three other ambient-theme read sites in this subsystem (ResourceDictionary.cs:579, :1375, :1413), so this remains the one inconsistent read.

Overall verdict

One medium-ish/low finding remains outstanding (the CoreServices.HasInstance guard, re-flagged inline with a concrete one-line fix). No new issues found in this pass, and nothing has regressed since the last round.
· branch dev/mazi/notifyanims

// back to the requested-theme-for-subtree slot, which mid-boundary carries the very theme the pin escapes.
if (owner is null || owner.GetTheme() == Theme.None)
{
return Uno.UI.Xaml.Core.CoreServices.Instance.Theming.GetBaseTheme() | GetApplicationHighContrastTheme();

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.

Still open from the two prior review rounds (2026-09-24, 2026-09-25): this fallback calls CoreServices.Instance directly, which eagerly constructs the CoreServices singleton if one doesn't already exist. Every other ambient-theme read in this subsystem guards the same read with CoreServices.HasInstance first — e.g. ResourceDictionary.GetActiveTheme() (ResourceDictionary.cs:1411-1425, whose own doc comment calls out "early/unit-test contexts that have no CoreServices instance") and the two other HasInstance call sites in that file (ResourceDictionary.cs:579, :1375).

ResolvePinnedOwnerTheme is reachable from unit tests exercising VSM setter {ThemeResource} resolution without a full app/window lifecycle. Hitting the owner is null || owner.GetTheme() == Theme.None branch there will construct CoreServices (and its EventManager) as a side effect of a resource lookup — exactly what HasInstance exists to avoid elsewhere in this file.

if (owner is null || owner.GetTheme() == Theme.None)
{
    return Uno.UI.Xaml.Core.CoreServices.HasInstance
        ? Uno.UI.Xaml.Core.CoreServices.Instance.Theming.GetBaseTheme() | GetApplicationHighContrastTheme()
        : ResourceDictionary.GetActiveBaseTheme() | GetApplicationHighContrastTheme();
}

Fix this →

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.

private bool _isProcessingThemeWalk;
// Per-store transient lifecycle/theme flags, packed into one field instead of one bool field per
// flag — WinUI packs the equivalent state into CDependencyObject's m_bitFields (corep.h:224-348).
[global::System.Flags]
/// property is not a <see cref="DependencyProperty"/>.
/// </returns>
internal static bool ApplyVisualStateSetter(SpecializedResourceDictionary.ResourceKey resourceKey, object context, BindingPath bindingPath, DependencyPropertyValuePrecedences precedence, ResourceUpdateReason updateReason)
internal static bool ApplyVisualStateSetter(SpecializedResourceDictionary.ResourceKey resourceKey, object context, BindingPath bindingPath, DependencyPropertyValuePrecedences precedence, ResourceUpdateReason updateReason, DependencyObject setterOwner = null)
Comment on lines +305 to +307
// bool modiferValueBeingSet = (pModifiedValue && pModifiedValue->HasModifiers());
// if (modiferValueBeingSet) pModifiedValue->SetModifierValueBeingSet(true);
// auto modiferGuard = wil::scope_exit([&] { if (modiferValueBeingSet) pModifiedValue->SetModifierValueBeingSet(false); });
Comment on lines +167 to +169
// Establish the per-object theme on the lazily-built VisualState chain (storyboard,
// animations, keyframes, setters); without it a keyframe keeps _theme=None and later
// re-resolves its {ThemeResource} against the unscoped app base theme.
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237176 found UI Test snapshots differences: skia-linux-screenshots: 119, skia-windows-screenshots: 174

Details
  • skia-linux-screenshots: 119 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • Buttons.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • DisplayInformation.png-dark
    • DynamicFont.png-dark
    • DynamicFont.png
    • ImageBrush_Formats.png-dark
    • ImageBrush_Formats.png
    • ExpanderColorValidationPage.png-dark
    • ElementLevelTheme.png-dark
    • ExpanderColorValidationPage.png
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Examples.png
  • skia-windows-screenshots: 174 changed over 2456

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DeferLoadStrategyWithTemplateBinding.png-dark
    • DeferLoadStrategyWithTemplateBinding.png
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DynamicBrushes_On_Shapes.png-dark
    • DynamicBrushes_On_Shapes.png
    • Examples.png
    • Grid_InsideStackPanel_InsideButton.png-dark
    • Grid_InsideStackPanel_InsideButton.png
    • Grid_in_Canvas.png-dark
    • Grid_in_Canvas.png
    • Grid_in_GridClipping.png-dark

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

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants