You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ThemeService sets RequestedTheme on XamlRoot's content instead of its own root element (breaks theme switching when hosted in foreign XamlRoot / ALC) #3120
Uno.Extensions.Toolkit.ThemeService (consumed via UseThemeSwitching / IThemeService, registered as ScopedThemeService) applies the theme to RootElement.XamlRoot.Content rather than to RootElement itself. When an app's content is hosted under a XamlRoot it doesn't own — e.g. a secondary app loaded into a collectible AssemblyLoadContext whose Window.Content is re-parented into a host's single shared XamlRoot — the theme is applied to the host's root visual instead of the app's. Toggling the theme re-themes the host while the hosted app does not change.
Expected behavior
When theme switching is toggled via IThemeService.SetThemeAsync(...), the hosted app's theme should change, and ThemeChanged should fire correctly. The behavior should be consistent whether the app is standalone or hosted under a foreign XamlRoot.
How to reproduce it (as minimally and precisely as possible)
App registers theme switching (UseThemeSwitching()), with a light/dark toggle calling IThemeService.SetThemeAsync(...).
Run the app hosted inside another app's XamlRoot — a secondary-app/ALC scenario where the inner app's Window.Content is mounted into a host's XamlRoot.
Toggle the theme.
Expected: the hosted app re-themes. Actual: the host re-themes; the hosted app does not. ThemeChanged also fails to fire.
Note: Standalone apps are unaffected because there window.Content == XamlRoot.Content, so the bug is invisible.
Activity
fix(themeservice): apply theme to own root, not XamlRoot content
fix(themeservice): log unrealized no-op + harden #3120 regression test
test(themeservice): assert the write target deterministically in #3120 …
test(themeservice): add real-dispatcher convergence guard for #3120
docs(themeservice): record verified test approach + results in spec 007
style(themeservice): wrap debug-log ifs in braces per review
docs(themeservice): add spec 007 for foreign-XamlRoot theme fix