1.6 Preview 1: Breaks resource lookups from referenced libraries using full resource paths. Exception: 'ResourceMap Not Found'. #4669
Labels
area-DeveloperTools
Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration
area-MRTCore
ResourceManager
Describe the bug
Apps that reference libraries or library projects that contain either resx or resw resource files can no longer do resource lookups using their full paths.
Resource lookups via ResourceLoader.GetForViewIndependentUse() and passing a resource path such as "App1Library/Resources" throw the following exception:
System.Runtime.InteropServices.COMException
HResult=0x80073B1F
Message=ResourceMap Not Found.
ResourceMap Not Found.
Source=WinRT.Runtime
StackTrace:
at WinRT.ExceptionHelpers.g__Throw|38_0(Int32 hr)
at ABI.Windows.ApplicationModel.Resources.IResourceLoaderStatics2Methods.GetForViewIndependentUse(IObjectReference _obj, String name)
at Windows.ApplicationModel.Resources.ResourceLoader.GetForViewIndependentUse(String name)
This exception was originally thrown at this call stack:
WinRT.ExceptionHelpers.ThrowExceptionForHR.__Throw|38_0(int)
ABI.Windows.ApplicationModel.Resources.IResourceLoaderStatics2Methods.GetForViewIndependentUse(WinRT.IObjectReference, string)
Windows.ApplicationModel.Resources.ResourceLoader.GetForViewIndependentUse(string)
AIForged.Helpers.ResourceExtensions.GetLocalized(string, string) in Tools.ResourceExtensions.cs
This even affects controls from vendors such as Syncfusion.
Steps to reproduce the bug
Create a WinUI 3 class library with WindowsAppSDK 1.6 Preview 1 and call it App1Library.
1.1 Add a resource (resx or resw) file and add some strings to it.
Create a WinUI 3 desktop app with WindowsAppSDK 1.6 Preview 1.
2.1 Add a reference to App1Library
2.2 Attempt to retrieve a resource via ResourceLoader.GetForViewIndependentUse() using the full resource path such as "App1Library/Resources".
Expected behavior
This worked in 1.5 and earlier versions.
Screenshots
NuGet package version
Windows App SDK 1.6 Preview 1: 1.6.240807006-preview1
Packaging type
Packaged (MSIX), Unpackaged
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered: