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

Code generators not working properly for Binding to ObservableProperty #1011

Open
1 of 4 tasks
bjorn-malmo opened this issue Dec 3, 2024 · 0 comments
Open
1 of 4 tasks
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior

Comments

@bjorn-malmo
Copy link

Describe the bug

Code generators fail to generate correct code for Bindings. Binding to a property marked with [ObservableProperty], will not reflect changes correctly. x:Bind works, but since this is not possible to use from a Control template, it is not a feasible workaround.
PropertyChanged event is raised as expected.

The project will build perfectly nice, but bindings will stop working, making it a very nasty bug to find!

I'm not entirely sure what is causing the problem, but building my test project (linked below) works using Visual Studio 17.10.6, but not using Visual Studio 17.12.0.

Regression

No response

Steps to reproduce

Please see project PropertyBindingTest.sln in repo https://github.com/bjorn-malmo/bug-free-happiness/.

Expected behavior

Expected Binding to reflect changes

Screenshots

This is a screen shot of the running application, using Visual Studio 17.12.0:

screen1.mp4

And this is when running the exact same application using 17.10.6:

screen2.mp4

Note that the difference of Custom1 and Custom2 is that Custom1 control uses [ObservableProperty] while Custom2 has an explicit declaration of INotifyPropertyChanged.

In the UserControl1, the difference is using Binding vs x:Bind.

I've tried binding to a Visibility property to verify if it is a conversion bool/visibility-problem, but the same problem appear.

IDE and version

VS 2022

IDE version

17.10.6 vs 17.12.0

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.3.2

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

@bjorn-malmo bjorn-malmo added the bug 🐛 An unexpected issue that highlights incorrect behavior label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

No branches or pull requests

1 participant