Skip to content
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

Closed
espritm opened this issue Sep 13, 2021 · 0 comments · Fixed by #14642
Assignees
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 🐛
Projects

Comments

@espritm
Copy link

espritm commented Sep 13, 2021

Description

A null pointer exception occurs while implementing drag and drop gesture recognizer

Steps to Reproduce

A. Unit test :

  1. Call the method Xamarin.Forms.Platform.iOS.DragAndDropDelegate.SendEventArgs with a null view
  2. It crashes with a null pointer exception

B. UI Test :

  1. Get the Xamarin Forms project from github : https://github.com/espritm/Grid_Sort_Issue.git
  2. Deploy it on a iOS simulator (I tested with iPad iOS 14.5)
  3. Start a Drag gesture on a Tile, and drag over tiles until the app crashes with a null pointer exception.

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

  • Version with issue: Xamarin 11.16.000.174
    • iOS: Xamarin.iOS 14.20.0.25

Environment

Show/Hide Visual Studio info
Microsoft Visual Studio Community 2019
Version 16.11.2
VisualStudio.16.Release/16.11.2+31624.102
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Community

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.11.75.64347
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019   16.11.75.64347
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.11.75.64347
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.11.75.64347
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

GitHub.VisualStudio   2.11.102.28613
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node   2.6.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.6.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.10
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio   16.10.15 (552afdf)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   5.11.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Razor (ASP.NET Core)   16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   16.0.62107.28140
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.11.0-beta.21322.6+488cc578cafcd261d90d748d8aaa7b8b091232dc
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

Visual Studio Tools for Unity   4.11.3.0
Visual Studio Tools for Unity

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   16.11.000.174 (d16-11@e8f56f1)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.11.0.17 (remotes/origin/11e0001f0b17269345e80b58fb3adf1ba4efe2cd@11e0001f0)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.10.5 (355b57a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.4.0.5 (d16-11/7776c9f)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: c633fe9
    Java.Interop: xamarin/java.interop/d16-11@48766c0
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.35.4@85460d3
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@683f375


Xamarin.iOS and Xamarin.Mac SDK   14.20.0.25 (3b53e529b)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

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.

@espritm espritm added s/unverified New report that has yet to be verified t/bug 🐛 labels Sep 13, 2021
@jsuarezruiz jsuarezruiz added this to New in Triage via automation Sep 13, 2021
@jsuarezruiz jsuarezruiz added i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 and removed s/unverified New report that has yet to be verified labels Sep 13, 2021
@jsuarezruiz jsuarezruiz self-assigned this Sep 21, 2021
@jsuarezruiz jsuarezruiz moved this from New to Ready For Work in Triage Sep 21, 2021
Triage automation moved this from Ready For Work to Closed Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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 🐛
Projects
Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

2 participants