Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Realm + Listview with caching strategy issue ?

uNiverseuNiverse USMember ✭✭

Hello everyone,

I recently encountered an issue with a simple xamarin.forms app (iOS only for now), using Realm as local database.

I created a page with a listview (with caching strategy to RecycleElement) displaying a list of RealmObject. Everything was fine until i put a delete context actions on the cell of my listview.

The problem was : When i deleted an item, then i added a new one:

  • The displayed informations in the cell was from the deleted item
  • I couldn't click on it and go to the detail page because of this error : "attempted to access detached row".

I struggled to find a solution, i even found a bugzilla from 2016 about it and heard they fixed it.

Then i tried to remove the caching strategy from the listview and come back to the default one (RetainElement). And the problem disappeared.

So i just wanted to share that for everyone who has or will struggle with this. And i've some questions:

  • Is this issue is not one and should error due to the Recycle Strategy ?
  • Is this a Realm or a Xamarin issue ?
  • Can this be avoid with another way ?


Best regards,



  • uNiverseuNiverse USMember ✭✭

    Up !

  • Nor0xNor0x USMember ✭✭

    @uNiverse said:
    Up !

    Up! Again. did you find any solution for this?

  • uNiverseuNiverse USMember ✭✭

    @Nor0x Hello ! Well nop, i ended deleting my row another way and i didn't really have time look more into it.

    If you find anything, keep me posted :)

    Maybe someone have an idea now ?

    Best regards,


  • LarsLaehnLarsLaehn USMember


    have anyone a solution for it?


  • RyanDixonRyanDixon USMember ✭✭✭

    Rather than deleting it, could you "unmanage" the realm object and then check for that when you perform your logic?
    As for the bug, pretty certain its a Xamarin bug with it trying to use a cache for a deleted binding context.

    Don't see why this cache isn't exposed to be honest so we can clean it up ourselves?

  • uNiverseuNiverse USMember ✭✭

    Hi @RyanDixon ,

    Maybe we can unmanage the realm object but will it still be in memory ? As we want to delete a row, it's supposed to be deleted. I don't want it to stay somewhere I won't remember later ^^.

    And yeah, we should be able to manage the cache as well.

    Best regards,

Sign In or Register to comment.