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

Twoway bindings call setters in outdated DataContexts when they shouldn't #13020

Closed
ramezgerges opened this issue Jul 26, 2023 · 1 comment
Closed
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, ...)

Comments

@ramezgerges
Copy link
Contributor

ramezgerges commented Jul 26, 2023

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 in When_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

@ramezgerges ramezgerges added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jul 26, 2023
@jeromelaban jeromelaban added project/binding 🪢 Categorizes an issue or PR as relevant to the binding engine and removed triage/untriaged Indicates an issue requires triaging or verification labels Jul 26, 2023
@MartinZikmund MartinZikmund added area/xBind 🪢 Categorizes an issue or PR as relevant to x:Bind project/navigation-lifecycle 🧬 Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...) difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Sep 20, 2023
@jeromelaban
Copy link
Member

Fixed in #13698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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, ...)
Projects
None yet
Development

No branches or pull requests

3 participants