When I'm on a page that has a ListView with a bound ItemSource and grouping enabled, after I scroll up in the list and then go back a page, the app crashes.
If I don't have any CachingStrategy set in the ListView I get the following error:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'CellTableViewCell'.
ObjectDisposedException.txt
If I set CachingStrategy to 'RecycleElement' I get the following error:
System.NullReferenceException: Object reference not set to an instance of an object
NullReferenceException.txt
Pop page without crash
App crashes
Could you attach a sample where we can reproduce the problem?.
It seems I'm not able to create a reproducing sample because it works in the sample. I'll get into it a bit more to see if it's really XF messing with me or something else. I can't really upload the whole project we're currently working on.
I'll let you know if I find out more or when I'm able to create a reproducing sample.
Thanks! We'll look for your reply.
@eddie010 Since we haven't heard from you in more than 30 days, we hope this issue is no longer affecting you. If it is, please reopen this issue and provide the requested information so that we can look into it further. Thank you!
Hi Guys,
I'm seeing the same. I've created a sample project which you can check over here: https://github.com/Pietervdw/XamarinGroupedListviewWeirdness
This only happens on iOS, it works fine on Android. I've tested on iOS 12.4, using the latest version of Xamarin.Forms.
I've recorded a video of the behavior: ListviewWeirdness_video.zip
To reproduce the behavior, start the app:
The app crashes:

Here is the stack trace of the error:
at Xamarin.Forms.Platform.iOS.TextCellRenderer.HandleCellPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x0002a] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Cells\TextCellRenderer.cs:49
at Xamarin.Forms.Platform.iOS.CellTableViewCell.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Cells\CellTableViewCell.cs:44
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:173
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:339
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:622
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00179] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:422
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00220] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:167
at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78
at Xamarin.Forms.Binding.Apply (System.Object context, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:131
at Xamarin.Forms.BindableObject.ApplyBindings (System.Boolean skipBindingContext, System.Boolean fromBindingContextChanged) [0x00041] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:453
at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x00007] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:472
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:624
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00179] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:422
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:572
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:122
at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:26
at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].UnhookItem (TItem item) [0x000a5] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:1207
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/Foundation/NSAction.cs:178
Hope this helps! If it is something I've done wrong in the project, please let me know.
@Pietervdw I found this thread because I was experiencing the same problem. I think I have found a workaround of sorts and narrowed down the issue (in my solution at least).
If I define my own GroupHeaderTemplate on my ListView the crash no longer occurs.
@jschwellnus92 Wow! You're right. Adding a GroupHeaderTemplate makes the problem go away. Thanks!
Most helpful comment
@Pietervdw I found this thread because I was experiencing the same problem. I think I have found a workaround of sorts and narrowed down the issue (in my solution at least).
If I define my own GroupHeaderTemplate on my ListView the crash no longer occurs.