Bug 26147 - NullReferenceException when swiping over Context Actions
Summary: NullReferenceException when swiping over Context Actions
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.3.1
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-01-19 01:25 UTC by Prashant Cholachagudda
Modified: 2015-03-21 08:02 UTC (History)
6 users (show)

Tags:
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:
Status:
VERIFIED FIXED

Description Prashant Cholachagudda 2015-01-19 01:25:16 UTC
We get NRE when we try access context actions on iOS, it works as expected on Android.

## Stack trace

System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.iOS.ContextScrollViewDelegate.GetContextCell (UIKit.UIScrollView scrollView) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.ContextScrollViewDelegate.RemoveHighlight (UIKit.UIScrollView scrollView) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.ContextScrollViewDelegate.WillEndDragging (UIKit.UIScrollView scrollView, CGPoint velocity, CoreGraphics.CGPoint& targetContentOffset) [0x00000] in <filename unknown>:0
  at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
  at XF4.iOS.Application.Main (System.String[] args) [0x00008] in /Users/prashantvc/Desktop items/Xamarin/117444/XF4/iOS/Main.cs:17

## Sample code

	public class App : Application
	{
		public App ()
		{
			var tableView = new TableView
			{
				Intent = TableIntent.Settings,
				Root = new TableRoot("TableView Title")
				{
					new TableSection("Table Section 2")
					{
						new TextCell
						{
							Text = "Swipe ME",
								Detail = "And I will crash!",
								ContextActions = { 
								new MenuItem
								{
									Text = "Text0"
								},new MenuItem
								{
									Text = "Text1"
								},
								new MenuItem
								{
									Text = "Text2"
								},
								new MenuItem
								{
									Text = "Text3"
								},
								new MenuItem
								{
									Text = "Text4",
									IsDestructive = true,
								}}
						},
					}
				}
			};

			// The root page of your application
			MainPage = new ContentPage {
				Content = tableView
			};
		}
	}
Comment 1 Fredrik Haglund 2015-01-19 05:15:12 UTC
An
Comment 2 Abhishek 2015-01-19 05:36:09 UTC
I have tried this issue and able to reproduce the reported behavior at my end.

Step to Reproduce:

1. Create a Xamarin Form application.
2. Copy the given code and paste it in the App class.
3. Run the application on the simulator.
4. 'Swipe Me' from right to left and application crashes.
5. Give the 'System.NullReferenceException' Exception.

Screencast: http://www.screencast.com/t/UhrTwisMhvIZ
Application Output: https://gist.github.com/Abhishekk360/019158ad46be249d289c


Build Info:
=== Xamarin Studio ===

Version 5.7 (build 661)
Installation UUID: 93e693b0-b53d-40f4-b29c-b61ff5cbe892
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.6.0.51 (Business Edition)
Hash: dfb682f
Branch: 
Build date: 2015-01-08 13:39:32-0500

=== Xamarin.Android ===

Version: 5.0.0.16 (Business Edition)
Android SDK: /Users/xamarin23/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Build Information ===

Release ID: 507000661
Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78
Build date: 2015-01-05 16:31:31-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7

=== Operating System ===

Mac OS X 10.10.0
Darwin 800BC.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 3 Fredrik Haglund 2015-01-19 07:13:22 UTC
Also noted that if you add another TextCell with Context Actions, you will only get a NRE on the first item in the list.
Comment 4 Jason Smith [MSFT] 2015-01-25 05:36:40 UTC
Should be fixed in 1.3.2 final
Comment 5 Abhishek 2015-01-30 10:25:28 UTC
I have check this issue by update forms 1.3.2.6306-pre2 and found that it is working fine.

So I am closing this issue.
Comment 6 Abhishek 2015-01-30 10:29:14 UTC
An update for Comment 5, I have used updated forms 1.3.2.6309-pre2.

forms 1.3.2.6306-pre2 -> forms 1.3.2.6309-pre2
Comment 7 jay 2015-03-21 08:02:00 UTC
hi all it crash when i update it to  latest 1.4.0 [Xamarin forms]
Comment 8 jay 2015-03-21 08:02:35 UTC
hi jason it crash when i update it to  latest 1.4.0 [Xamarin forms]