Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: XAML Data binding fails when using a value converter in Release configuration #1904

Open
ootbutterfus opened this issue Jan 23, 2025 · 0 comments

Comments

@ootbutterfus
Copy link

Description

Using WinUI 3, if a XAML data binding uses a value converter it will fail when using the 'Release' configuration. It works fine using the 'Debug' configuration. Somewhat related, a strongly typed binding {x:bind} that uses a value converter doesn't work using either the debug, or release build configuration.

Steps To Reproduce

1.) Attached is a Visual Studio solution created using the Blank App, Packaged (WinUI 3 in Desktop) project template.
2.) I created a MonthConverter class that implements IValueConverter. It converts a DateTime to a string that outputs the month as text.
3.) In the MainWindow class I created a 'Now' property that returns DateTime.Now.
4.) In the MainWindow.xaml file I created a TextBlock that binds to the MainWindow.Now property.
5.) I set the TextBlock's Binding Converter to use a MonthConverter XAML Resource.
6.) Run the app using the 'Debug' build configuration. Everything works great. The month is displayed by the binding within the TextBlock.
7.) Run the app again using the 'Release' build configuration. The binding no longer displays the month.
8.) If you use a strongly typed x:Bind instead, it won't work using either the Debug or Release configuration. It says the resource can't be found.

BrokenConverterExample.zip

Expected Behavior

When you run the application you should see the current month printed in full. It works as expected using the 'Debug' build configuration. Change the build configuration to 'Release' and run the application. The month is no longer printed. The binding no longer outputs a value.

Version Info

Visual Studio 2023 (17.12.3)
Windows App SDK 1.6.250108002

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant