Twoway bindings call setters in outdated DataContexts when they shouldn't #13020
Labels
area/xBind 🪢
Categorizes an issue or PR as relevant to x:Bind
difficulty/medium 🤔
Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI
kind/bug
Something isn't working
project/binding 🪢
Categorizes an issue or PR as relevant to the binding engine
project/navigation-lifecycle 🧬
Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...)
Current behavior
On Windows, if a ComboBox with bindings like in #11956's repro has its DataContext cleared, the setter of the two way-bound property of the (now old) DataContext is called, but the getter isn't. In a runtime test with the same scenario, neither the getter nor the setter are called. In uno, the setter is called (and the getter, but that's fixed in #12995). Notice however, that if we use a custom element instead of build-in elements, the setter is called inside the runtime test also on Windows.
Expected behavior
Uno shouldn't call the setter in the runtime test version of the repro (and perhaps other scenarios).
How to reproduce it (as minimally and precisely as possible)
Add
Assert.AreEqual(dc.GetterAccessedAfterDispose, false);
to the end of the try block inWhen_ComboBox_Multiple_Bindings_DataSource_Cleared
found in #12995.Workaround
No response
Works on UWP/WinUI
Yes
Environment
Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
NuGet package version(s)
No response
Affected platforms
No response
IDE
No response
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response
The text was updated successfully, but these errors were encountered: