CommunityToolkit / CommunityToolkit/dotnet
ObservableProperty failed in release mode
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
I start to have a problem with the last version of CommunityToolkit.Mvvm 8.4.0 (I tried 8.3.2 too), where it fails to change an Observable Property when using RelativeSource AncestorType on Release mode.
So, I have a user control that appears every time the MessageShow changed to True in ViewModel. After click on a button inside of the control, the same property is changed to False.
Every time I need to show the control a do the same.
It stop to work after I update Toolkit and SDKs.
Here is a sample, works in Debug but fails in Release mode:
```
```
I tried to disable AOT and Trimmed but no luck.
So I found this approach and it worked:
```
```
Don't know if a BUG or bad usage, but was working in the past...
### Regression
SDK 9.0.202
### Steps to reproduce
1) Create a user control with Binding properties;
2) Put it on a View;
3) Change the property from ViewModel;
4) Change the property in User Control;
5) Property is not changed on ViewModel;
### Expected behavior
Observable Property should be updated on ViewModel after it's changed in the user control.
### Screenshots
_No response_
### IDE and version
VS 2022
### IDE version
17.14.9
### Nuget packages
- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [x] CommunityToolkit.Mvvm (aka MVVM Toolkit)
### Nuget package version(s)
8.4.0
### Additional context
_No response_
### Help us help you
No, just wanted to report this
Contributor guide
Assessment
This issue has not been assessed yet.