-
Notifications
You must be signed in to change notification settings - Fork 804
Open
Labels
Description
Describe the bug
Custom class defined in xaml constructs new CustomXamlResourceLoader in its static constructor. In xaml the setup is the following:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary>
<local:UserThemeResources x:Key="ResourceLoaderInitializer" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="{CustomResource DarkResourcesPath}"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>In the constructor of UserThemeResources we set:
CustomXamlResourceLoader.Current = new UserThemeResourceLoader();This builds and runs fine with WindowsAppSDK 1.6.25.
In 1.7.256 version of SDK we get:
{Microsoft.UI.Xaml.UnhandledExceptionEventArgs}
Exception: {"The text associated with this error code could not be found.\r\n\r\nNo custom resource loader set. [Line: 17 Position: 27]"}
and also the static constructor of UserThemeResources is not fired at all.
Steps to reproduce the bug
Run the application with WindowsAppsSDK 1.7.25 restored. Notice the exception
Expected behavior
No exception and the constructor to fire.
Screenshots
NuGet package version
None
Windows version
Windows 11 (24H2): Build 26100
Additional context
No response
Reactions are currently unavailable
