The listview caching strategy have to be "Recycle element"
Select an item in a listview with context actions with a long click. then on android the context action bar appears on the top, and the selected item gets a blue background. Now scoll a few times down and up, so that the selected item is scrolled out of diplay and comes again on display. This causes a crash with a System.NullReferenceException.
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages for the latest pre release 2.3.2-pre1, please reopen this report with an attached reproduction.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d
Xamarin Forms Team
Created attachment 17127 [details]
I can still reproduce the crash with Forms 2.3.2-pre1. I've attached a repro project.
### Steps to Reproduce
1. Run the attached Android project
2. Long press a list item to open the context actions
3. Scroll the ListView around
### Expected Results
No app crash
### Actual Results
The app will crash. It appears to happen when the selected item is displayed on screen again then scrolled offscreen.
Reopening due to comment 2
Should be fixed in 2.3.4-pre1
A similar bug is in iOS. When activating a context action (delete) in a listview and scrolling up/down, you get the following:
System.ArgumentNullException has been thrown
Value cannot be null.
Parameter name: gestureRecognizer
I have made a test project which shows this behavior: https://github.com/KolibriDev/TestLayoutXaml
Created attachment 18355 [details]
This is a reproduction of the issue(s) described.
I have not been able to test against 2.3.4-pre1, but I was testing against 220.127.116.11-pre4. I noticed this issue, and one other which I believe has a very similar root cause. The second issue I found was that if you have the context action bar present and perform an orientation change, the amount of times varies but 1 - 2 times should do it, the app will crash. From what I can gather these issues only occur when certain conditions are met:
First, ListViewCachingStrategy.RecycleElement needs to be set for the ListView.
Second, You have to be using data binding for the crash to occur. If you just have a ListView that contains views without any BindingContext the crash does not occur.
I have added a test project as well which should exhibit both issues: