Bug 59030 - Two-finger gestures broken in Xamarin.Forms for UWP
Summary: Two-finger gestures broken in Xamarin.Forms for UWP
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: unspecified
Hardware: PC Windows
: --- blocker
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-08-25 00:17 UTC by aglaiafei
Modified: 2017-12-04 16:16 UTC (History)
4 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:
RESOLVED NOT_REPRODUCIBLE

Description aglaiafei 2017-08-25 00:17:08 UTC
# Steps to reproduce
1- Create a Xamarin.Forms project.
2- Add an image or any view with a gesture recognizer that has two fingers, so PinchGestureRecognizer or PanGestureRecognizer with touchPoints = 2. You can do this in XAML or the code behind: it won't matter. Whether or not it's an image or another view or a custom renderer doesn't matter.
3- Implement the method or lambda function for PinchUpdated/PanUpdated, whether with actual code or just leave it empty and return: it won't matter.
4- Build the project and test it on a local machine, simulator, or device connected via USB.
5- Try to use the multi-touch gesture for a minute.


# Expected behavior
The two-finger gesture should trigger the event with whatever code you've added to it (could be no code at all), every time you use that gesture. 

# Actual behavior
Within a minute at most of using the two-finger gesture a NullArgumentException is triggered, and here's the message, the same for both pan and pinch gesture recognizers:

System.NullReferenceException: Object reference not set to an instance of an object.\r\n   
at Xamarin.Forms.Platform.UWP.VisualElementTracker`2.HandlePinch(ManipulationDeltaRoutedEventArgs e, View view)\r\n  
at Xamarin.Forms.Platform.UWP.VisualElementTracker`2.OnManipulationDelta(Object sender, ManipulationDeltaRoutedEventArgs e)


# Test environment (full version information)
First I encountered this bug in my own shared project. I tried updating Xamarin.Forms to the latest stable version to no avail; so my Xamarin.Forms nuget is version: 2.3.4.267; I had a previous version before which would also throw the exception. 

Finally I created a new PCL Xamarin Forms project with a new UWP app template and added only an image with the two-finger gesture recognizers, and had the same issue.
Comment 1 Paul DiPietro [MSFT] 2017-08-25 15:38:05 UTC
I don't seem able to reproduce this on a new project using a PinchGestureRecognizer or using the PinchGesture sample project[1]. Could you upload a reproduction and provide more detail on what you're running the project on, and if the issue occurs for you on the 2.4.0-pre1 build?

[1] https://developer.xamarin.com/samples/xamarin-forms/WorkingWithGestures/PinchGesture/
Comment 2 aglaiafei 2017-08-26 10:20:20 UTC
I've successfully reproduced the same problem with a copy of the Pinch Gesture solution you provided. Now I must say I'm roughing it up and not pinching/tapping/panning like the average user would. However the exception is thrown almost immediately on the simulator (much quicker if I zoom in and out then left click somewhere else on the image, but zooming in and out will eventually get me there as well.) 

It takes a little longer on the ARM Windows 10 device connected via USB but still not that long if I pinch in and out on various parts of the image(again tapping with two fingers in between pinches makes it throw faster.)

I have tried updating to the 2.4 pre-build of Xamarin Forms in the Pinch Gesture project, and I'm encountering the same issue. 

The computer I'm using to build the project (and run the simulator) is a MacBook Pro, with Windows 10 installed via BootCamp, and I'm building the project in Visual Studio 2017.

I don't think there is a point in me uploading other projects since I'm now using the Pinch Gesture demo to reproduce the problem, but I have recorded a screen capture of the simulator and the ARM device (via Project My Screen and the Xbox recording tool), as well as ones of Visual Studio throwing the exception.

The google drive folder with the videos:
https://drive.google.com/drive/folders/0B9ZX4I68YIITbWVvTEFSUll4Q3M?usp=sharing
Comment 3 john 2017-11-05 00:15:03 UTC
Using Xamarin.Forms and Xamarin.Forms.Pages v2.5.0.19271-pre2 in my own NET Standard 1.4 project, I do not experience crashes as described above. However, the pinch gesture is not recognized on a Nokia 830 phone UWP ARM release build, while the debug build works fine. Pinch also works fine for UWP x64 and Android, both release and debug, on a laptop.
Comment 4 Paul DiPietro [MSFT] 2017-12-04 16:16:53 UTC
As no further comments regarding the original issue have been made, we are closing this as not reproducible. Please reopen this with a working reproduction that exhibits the issue if it occurs as of the latest 2.5.0 stable build.

Guidelines for creating reproductions are available at:
https://github.com/xamarin/Xamarin.Forms/wiki/Submitting-Bug-Reports