Uno.WindowsCommunityToolkit icon indicating copy to clipboard operation
Uno.WindowsCommunityToolkit copied to clipboard

ResourceNameToResourceString converter does not find the resource altough it exists.

Open Suriman opened this issue 3 years ago • 1 comments

Describe the bug

Using the converter to obtain a named resource provokes a NullReferenceException in WindowsCommunityToolkit and an empty string in the Uno.WindowsCommunityToolkit.

Steps to Reproduce

Launch the attached solution in Windows head, a NullReferenceException should be thrown after MainPage.InitializeComponent() is executed. If the xaml with the Converter is commented it does not throw. Launch the attached solution in WPF/Wasm head, a TextBlock with "Hello World", should be seen. The TextBlock which is using the Converter shows an empty string..

The resource is defined in Strings/en/Resources.resw and the same resource name is in a property of the code-behind of MainPage.xaml and x:binded to the Text property of the TextBlock.

Expected behavior

No error should be produced and the string resource should be set to the TextBlock.

Environment

NuGet package(s): Uno.WinUI Uno.WinUI 4.4.13, CommunityToolkit.WinUI.UI 7.1.2, Uno.CommunityToolkit.WinUI.UI 7.1.100-dev.15.g12261e2626

OS: Windows 11 21H2 22000.739

IDE: Visual Studio 2022

IDE version: 17.3.0 preview 2

Additional context

See the attached file. ResourceNameToResourceStringConverterIssue.zip

Suriman avatar Jul 08 '22 15:07 Suriman

Hi @Suriman Thanks for reporting this.

The issue on the Windows Head comes from the WindowsCommunityToolkit. since this is the library you are using in the references

For WASM and WPF, I will be validating why the converter is not finding the string and instead it returns an empty String.

ajpinedam avatar Jul 15 '22 13:07 ajpinedam