Bug 33413 - Android NullReferenceException with ListView context menu
Summary: Android NullReferenceException with ListView context menu
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-08-27 04:10 UTC by Simon Taylor
Modified: 2016-04-13 18:52 UTC (History)
6 users (show)

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

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:

Description Simon Taylor 2015-08-27 04:10:47 UTC
When the command for a context action MenuItem causes CanExecuteChanged to be raised for a menu item a NullReferenceException is raised in CellAdapter.OnContextActionCommandCanExecuteChanged(), presumably because actionMode has already been set to null.

// Xamarin.Forms.Platform.Android.CellAdapter
private void OnContextActionCommandCanExecuteChanged(object sender, EventArgs eventArgs)
	this.actionModeNeedsUpdates = true;
Comment 1 E.Z. Hart [MSFT] 2015-10-14 15:56:23 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue we would very much appreciate it.

Warm regards,
Xamarin Forms Team
Comment 2 John Hardman 2016-01-28 17:04:44 UTC
Looks like the same problem I am hitting on Android (Windows, WinPhone, and iOS are all ok).

Object reference not set to an instance of an object

I wonder if Android is expecting anything particular in the EventArgs being passed as the second argument to CanExecuteChanged? My code is simply:

CanExecuteChanged(this, new EventArgs());
Comment 3 Paul DiPietro [MSFT] 2016-04-13 18:52:33 UTC
Thank you for your bug report. As we have not received the information requested, we cannot properly triage your bug and are marking it resolved.

Warm regards,
Xamarin Forms Team