Skip to content

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

@ramezgerges

Description

@ramezgerges

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/xBind 🪢Categorizes an issue or PR as relevant to x:Binddifficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't workingproject/binding 🪢Categorizes an issue or PR as relevant to the binding engineproject/navigation-lifecycle 🧬Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions