We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Binding SFRichTextEditor to Realm crashes the App

My Xamarin Forms App is using Realm for direct binding to local storage like this https://www.mongodb.com/developer/languages/csharp/use-effectively-realm-in-xamarin-forms/.


Most of the SF controls work well when binding directly to the Realm objects ( See attached example for reference, binding an SfNumericUpDown or Xamarin's built-in Editor works well), however whent trying to bind the SFRichTextEditor, the App either freezes or just doesn't bind to my properties and no errors are displayed on the console to be able to track the issue.

Realm usually works on the main thread so I'm not sure if this is a threading issue with SFRichTextEditor specifically. 

 


Attachment: SharedGroceries_1c7049c.zip

7 Replies

HD Hemalatha Duraisamy Syncfusion Team February 13, 2023 02:12 PM UTC

We were able to reproduce the issue with “Freezes the app while binding the SfRichTextEditor to Realm”. In Android platform.  Currently, we are validating this issue and we will update the further details on February 15th, 2023.


They provided sample is working properly on iOS Platform. Please find video link below,

https://www.syncfusion.com/downloads/support/directtrac/general/ze/Realm-1585583302



HD Hemalatha Duraisamy Syncfusion Team February 15, 2023 05:57 PM UTC

Currently, we are validating the issue Freezes the app while binding the SfRichTextEditor to Realm in Android platform and we will update the further details on February 17th, 2023.



HD Hemalatha Duraisamy Syncfusion Team February 17, 2023 05:47 PM UTC

We were not able to reproduce the reported issue on a simple sample. The issue was only reproduced on the Realm sample. On further analyzation we found some suggestions to initialize and close the realm object in a proper thread. Kindly follow the links below to create the realm objects on the proper thread.


https://github.com/realm/realm-js/issues/4399
https://stackoverflow.com/questions/40344801/realm-access-from-incorrect-thread
https://www.mongodb.com/community/forums/t/how-to-load-data-in-the-background-without-running-into-incorrect-thread-exception-later-on/153491



JJ Juan Jiminez March 1, 2023 05:35 PM UTC

Hi Hemalatha, thanks for checkin this issue.


As you can see on the original example I attached, the Realm is only accessed on the UI thread so that shouldn't be a problem. On the other hand, you can see on the same sample the binding works with native Xamarin controls like Label and Entry and even with the SfNumericUpDown, it's just smething about the SfRichTextEditor which makes it fail when binding to the Realm but I cant figure it out becase there's no errors thrown so maybe you can check on your side what the internal exception  incompatibility is about.



MP Mohana Priya Raja Syncfusion Team March 2, 2023 03:58 PM UTC

RichTextEditor is a wrapper of content editable div elements. We were able to reproduce the reported issue when we use Hybrid Web View in the XForms android platform. We can replicate the same issue in the “contentEditable” div also, which has the same behavior as the Rich Text Editor. So, we have raised the query in Xamarin Discussion and please find the link from below, We will update further once the Xamarin team provides any update. 

https://github.com/xamarin/Xamarin.Forms/issues/15703

Please find the sample to ensure this behavior in the attachment and check the below screenshot illustration of the issue reproducing in the “contentEditable” div with Realm. 


Please find the screenshot without the Realm: