This repository has been archived by the owner on May 1, 2024. It is now read-only.
[Bug] NullPointerException occurs on file Xamarin.Forms.Platform.iOS\DragAndDropDelegate.cs line 125 #14602
Labels
a/DragAndDrop
i/high
Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often
p/iOS 🍎
t/bug 🐛
Description
A null pointer exception occurs while implementing drag and drop gesture recognizer
Steps to Reproduce
A. Unit test :
B. UI Test :
Expected Behavior
The app should never crash, nothing should happen if view is null in Xamarin.Forms.Platform.iOS.DragAndDropDelegate line 125
Actual Behavior
Sometimes, the app crashes with a null pointer exception
Basic Information
Environment
Show/Hide Visual Studio info
Build Logs
Exception Stacktrace :
{System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.DragAndDropDelegate.SendEventArgs[TRecognizer] (System.Action`1[T] func, Xamarin.Forms.View view) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\DragAndDropDelegate.cs:125
at Xamarin.Forms.Platform.iOS.DragAndDropDelegate.HandleDragLeave (Xamarin.Forms.View element, Xamarin.Forms.DataPackage dataPackage) [0x00019] in D:\a\1\s\Xamarin.Forms.Platform.iOS\DragAndDropDelegate.cs:209
at Xamarin.Forms.Platform.iOS.DragAndDropDelegate.SessionDidExit (UIKit.UIDropInteraction interaction, UIKit.IUIDropSession session) [0x00041] in D:\a\1\s\Xamarin.Forms.Platform.iOS\DragAndDropDelegate.cs:70
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65
at SampleApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Workspace\MyUBP\Modules\Sample\SampleApp\SampleApp.iOS\Main.cs:17 }
Screenshots
Reproduction Link
github repo : https://github.com/espritm/Grid_Sort_Issue.git
use command line : git clone https://github.com/espritm/Grid_Sort_Issue.git
Workaround
Tryied following workarounds, with no success :
In the client project, remove the DragGestureRecognizers before removing the view from the grid.
In the client project, set AllowDrop and CanDrag to false before removing the view from the grid.
The text was updated successfully, but these errors were encountered: