Uploaded image for project: 'Realm .NET SDK'
  1. Realm .NET SDK
  2. RNET-783

[Bug]: PropertyChange events lead to endless Binding loop in Xamarin Forms App

      What happened?

      In our Xamarin Forms app we have an EntryControl whose text property is bidirektional bound to a XF property which in turn is bidirektional bound to a RealmObject property.
      When the XF property is changed twice very quickly (by user interaction) the app hangs forever. The XF binding mechanism keeps changing the property value back and forth between the two values.
      The issue only occurs when binding to a persistent Realm property! When binding to a transient/ignored property (using RaisePropertyChanged), the binding works as intended.

      Please see the attached sample app:

      • Press the „Change transient value“ button -> the Entry displays „1“ very shortly and then switches to „2“ as intended
      • Press the „Change persistent value“ button -> the app hangs forever

      I think there is something wrong with the PropertyChange event propagation of persistent Realm properties.
      The following stacktrace was captured, when the MainPage „Value“ property was changed from „1“ to „2“.
      There you can see that the WovenSetterMethodInfo actually receives the value „2“ and invokes „RaisePropertyChanged“ - but MyRealmObject.Value is still „1“?! The value should be changed to „2“ before invoking „RaisePropertyChanged“.

      Repro steps

      Please see the attached sample app:

      • Press the „Change transient value“ button -> the Entry displays „1“ very shortly and then switches to „2“ as intended
      • Press the „Change persistent value“ button -> the app hangs forever

      Version

      10.14.0

      What SDK flavour are you using?

      Local Database only

      What type of application is this?

      Xamarin

      Client OS and version

      Android 10

      Code snippets

      https://github.com/markusroessler/XamarinRealmDelayedPropertyChange

      Stacktrace of the exception/crash you're getting

      No response

      Relevant log output

      No response

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: