Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
If you set the BindingContext property of BindableObject to a new object (different object reference) but is equal according the Equals method, the BindingContext will not change. The property for changing the method shouldn't even pay attention to the Equals method because it is not relevant, but if you put a breakpoint on Equals method of any BindingContext, you will see that the XF library is checking for equality on the new BindingContext, and then ignoring the new BindingContext if the Equals method returns true.
-Clone this repo: git clone https://ChristianFindlay@bitbucket.org/ChristianFindlay/xamarin-forms-scratch.git
-Open the solution Test Apps\TestXamarinForms.sln
-Run the UWP sample
-Click the "Binding Context Equality Issue" button
-Notice that the BindingContextEqualityPage_BindingContextChanged event handler is fired
-Click "Change BindingContext Buggy"
-Notice that it calls the Equals method on the model for no reason, and this method returns true because the "Key" property is the same on both models even though the text in "Test" is different
-Click "Change BindingContext OK"
-Notice that the BindingContextEqualityPage_BindingContextChanged event handler is fired because the "Key" property is different between models and therefore the Equals method returns false.
This behaviour is not standard Microsoft bding behaviour. This does not happen in Silverlight, WPF, and UWP.
I can confirm the reported behavior. Changing this is potentially a breaking change, but might be worth it to be aligned with other platforms.
Thanks for acknowledging the problem.
While there is a chance that this is a breaking change, currently, people must be writing hack code to work around this. So, it will be worth fixing now so that developers in future don't have to pile hack code on top of hack code to avoid this issue.
Should be fixed in 2.4.1.-pre1. Thank you!
You guys are killing it. Nice work.