Bug 26655 - ListView with ContextActions throws NullReferenceException when Multi-touch Tapped on empty and non-empty cell
Summary: ListView with ContextActions throws NullReferenceException when Multi-touch T...
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-02 15:43 UTC by Sten
Modified: 2016-04-08 19:00 UTC (History)
6 users (show)

Tags: ios crash ContextActions
Is this bug a regression?: ---
Last known good build:


Attachments
Test project (28.71 KB, application/zip)
2015-02-02 15:43 UTC, Sten
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 Sten 2015-02-02 15:43:33 UTC
Created attachment 9606 [details]
Test project

Tested with Xamarin.Forms 1.3.2.6313-pre3 on iOS

Setup:

A ListView, tested with ImageCell, with ContextActions

        <ListView x:Name="lstUsers"   RowHeight="80" ItemTapped="lstItemTapped" VerticalOptions="FillAndExpand">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ImageCell ImageSource="zoom_out.png" Text="{Binding Name}">
                        <ImageCell.ContextActions>
                            <MenuItem Text=" Details " />
                            <MenuItem Text=" Delete " IsDestructive="true" />
                        </ImageCell.ContextActions>
                    </ImageCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>


its items source is set in code-behind:


            users.Add(new User{ Name = "Touch with one finger an empty row, hold" });
            users.Add(new User{ Name = "Touch with another finger one of the text rows " });
            users.Add(new User{ Name = "while still holding the first finger in place" });
            users.Add(new User{ Name = "Lift one finger" });

            lstUsers.ItemsSource = users;  


Run on iOS (similator or hardware)

On the simulator position the mouse above a row, press Option (for multitouch) and click the mouse (one touchpoint should be outside the list

On hardware tap with two fingers when one is outside the list



The app crashes with 

System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.iOS.ContextActionsCell+SelectGestureRecognizer.Tapped (MonoTouch.UIKit.UIGestureRecognizer recognizer) [0x00000] in <filename unknown>:0 
  at MonoTouch.UIKit.UITapGestureRecognizer+Callback.Activated (MonoTouch.UIKit.UITapGestureRecognizer sender) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIGestureRecognizer.cs:206 
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62 
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46 
  at XamarinTesting.iOS.Application.Main (System.String[] args) [0x00009] in /Users/Sten/Projects/XamarinTesting/iOS/Main.cs:21
Comment 1 Naqeeb 2015-02-03 10:12:27 UTC
I have tried to reproduce this issue and able to reproduce with the help of attached sample project. I run the attached sample and tap the 'Test List View with Bindings Leaks' link, I observed that application gets crash.

Screencast: http://www.screencast.com/t/FFDwUMyafEPL
Ide log: https://gist.github.com/Mohit-Kheterpal/348b996e8ac9341322e6
Application output: https://gist.github.com/Mohit-Kheterpal/615a2a348cdfe5ca3ad1

Environment info: 
Xamarin.Forms 1.3.2.6313-pre3

=== Xamarin Studio ===

Version 5.7.1 (build 16)
Installation UUID: 3dbf10c4-ed30-4e55-8a8b-1704777c7b5f
Runtime:
 Mono 3.12.0 ((detached/a813491)
 GTK+ 2.24.23 (Raleigh theme)

 Package version: 312000068

=== Xamarin.Android ===

Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/apprpject/Desktop/android-sdk-macosx
 Supported Android versions:
  2.1    (API level 7)
  2.2    (API level 8)
  2.3    (API level 10)
  3.1    (API level 12)
  4.0    (API level 14)
  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_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.6.1.20 (Enterprise Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

=== Xamarin.Mac ===

Version: 1.12.0.4 (Enterprise Edition)

=== Build Information ===

Release ID: 507010016
Git revision: f12fcaf4707ab436bee2df6263eb5333197b262c
Build date: 2015-02-01 21:06:05-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.8.5
Darwin localhost 12.5.0 Darwin Kernel Version 12.5.0
    Sun Sep 29 13:33:47 PDT 2013
    root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
Comment 2 Sten 2015-02-03 10:21:03 UTC
I missed that in the original report but the test project contains two buttons on the home screen, the lower one "Test ListView Multi-touch Tap Crash" launches a test that demonstrates the crash.
Comment 3 Rui Marinho 2015-02-13 12:29:20 UTC
Hi, i can't reproduce this issue, also please try 1.3.3 and see if you get the same problem. If you can provide a screencast of the issue in 1.3.3 on a device that would be great.

Also take note theres a little bug on your sample code: Display alert must have a cancel text you can't pass it null.

DisplayAlert("Item tapped","Tapped", "ok");
Comment 4 Rui Marinho 2015-02-13 12:34:31 UTC
Please reopen if it sill happens on 1.3.4-pre4. 

Thanks.
Comment 5 Sten 2015-02-18 09:36:48 UTC
This still hapens in 1.3.4

On OSX run an iOS project  that has a list view with context actions and only a few items, run it in the simulator,  hold option and click on one of the items
Comment 6 Sten 2015-02-18 09:38:48 UTC
The attached sample project has another test, on the screencast it looks like that one was picked.
Comment 7 Seth Rosetter 2015-05-28 20:06:07 UTC
Hi Sten,

After updating to Xamarin.Forms 1.4.2 (lastest stable), I was able to see your issue using the simulator. However, on iOS device, I was unable to reproduce your crash. Can you confirm your crash is resolved on device? 

Thanks!

-Seth
Comment 8 Samantha Houts [MSFT] 2016-04-08 19:00:55 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