Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] iOS CellView BindingContextChanged Event -> Null Reference Within ContextActions Clear() #11943

Closed
breezy64 opened this issue Aug 27, 2020 · 0 comments · Fixed by #11944
Labels
a/listview Problems with the ListView/TableView in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Milestone

Comments

@breezy64
Copy link
Contributor

Description

On iOS, a null reference exception get's thrown if ContextAction.Clear() is called within the BindingContextChanged callback
of a ViewCell within a ListView. The problem seems to only happen when scrolling a very large list and the RecycleElement Caching strategy is is used

This is probably related to #10934

Steps to Reproduce

  1. Create a ListView.
  2. Assign the ListView's ItemTemplate to a ViewCell
  3. Add some ContextActions to the ViewCell
  4. Add a callback for the View Cell's BindingContextChanged event
    i) Call ContextActions.Clear() within the callback
  5. Populate a list view with items (the more the better)
  6. Keep scrolling until it crashes

Expected Behavior

Don't crash when scrolling a listview (given that the list view's individual cells might have changing context actions)

Actual Behavior

App crashes with a null reference exception

Basic Information

  • Version with issue: 4.8.0
  • Last known good version: N/A
  • IDE: Microsoft Visual Studio Enterprise 2019 Version 16.7.2
  • Platform Target Frameworks:
    • iOS: Deployment Target 13.6
  • Nuget Packages:
    • Rg.Plugins.Popup, Version=2.0.0.2
    • Xamarin.Forms, Version=4.8.0.1269
    • Xamarin.Essentials, Version=1.5.3.2
    • Newtonsoft.Json, Version=12.0.2

Stack Trace

`
SIGABRT: Object reference not set to an instance of an object

ContextActionsCell.OnContextItemsChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) D:\a\1\s\Xamarin.Forms.Platform.iOS\ContextActionCell.cs:488
(wrapper delegate-invoke) .invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
ObservableCollection1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) ObservableCollection1[T].OnCollectionReset ()
ObservableCollection1[T].ClearItems () Collection1[T].Clear ()
TimesheetListItemViewCell.OnBindingContextChanged ()
`

@samhouts samhouts added this to New in Triage Aug 27, 2020
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Aug 27, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Aug 27, 2020
@jsuarezruiz jsuarezruiz added a/listview Problems with the ListView/TableView t/bug 🐛 p/iOS 🍎 labels Aug 28, 2020
@jsuarezruiz jsuarezruiz moved this from New to Ready For Work in Triage Aug 28, 2020
@samhouts samhouts moved this from Ready For Work to Needs Estimate in Triage Aug 28, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 31, 2020
@samhouts samhouts removed this from In Progress in .NET MAUI Backlog Sep 1, 2020
@samhouts samhouts added this to In Progress in vNext+1 (5.0.0) Sep 1, 2020
Triage automation moved this from Needs Estimate to Closed Sep 7, 2020
vNext+1 (5.0.0) automation moved this from In Progress to Done Sep 7, 2020
@samhouts samhouts removed this from Closed in Triage Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/listview Problems with the ListView/TableView in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants