Bug 51410 - NRE when long pressing on listview cell item, and then interacting with cell
Summary: NRE when long pressing on listview cell item, and then interacting with cell
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.3
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2017-01-11 14:33 UTC by tim.ahrentlov
Modified: 2017-06-20 00:00 UTC (History)
4 users (show)

Tags: android
Is this bug a regression?: ---
Last known good build:


Attachments
Screenshot of problematic ListViewAdapter code (137.78 KB, image/png)
2017-01-11 14:33 UTC, tim.ahrentlov
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description tim.ahrentlov 2017-01-11 14:33:07 UTC
Created attachment 19231 [details]
Screenshot of problematic ListViewAdapter code

When you:

1. have a listview in ListViewCachingStrategy.RecycleElement mode, 
2. long-press to bring it into ContextAction mode
3. interact with the cell(s) again in the listview

the app receives an NRE and crashes.

Problems is due to the following:

1. In ListViewAdapter.cs on line 217 & 218 you'll find 

   ActionModeContext = null;
   ContextView = null;  

2. Setting the ContextView calls the setter in base CellAdapter.cs which on line 67 do:

   var isSelected = (bool)ActionModeContext.GetValue(ListViewAdapter.IsSelectedProperty);

3. Notice that ActionModeContext is referenced in #2 even though it has just been set to null in #1
Comment 1 Stephane Delcroix 2017-02-15 14:17:30 UTC
Please provide a sample project triggering this issue so we can confirm it and fix it.

The code you are referencing has changed since...
Comment 2 Samantha Houts [MSFT] 2017-06-20 00:00:12 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!