xamarin-forms-samples icon indicating copy to clipboard operation
xamarin-forms-samples copied to clipboard

[Bug] Drag a file and Drop into App raises ArgumentNullException

Open SunshineSpring666 opened this issue 4 years ago • 2 comments
trafficstars

Description

As instructed in Xamarin Drag and Drop documentation, Drag and Drop can "start in one application and end in another". However, when drag a file/image (e.g., file icon on desktop) from other app or File Explorer, exception got raised in OnDrop event.

Steps to Reproduce

  1. Create a Frame inside a ContentPage and set DropGestureRecognizer in it.
  2. Build and Run.
  3. Drag a file icon from File Explorer and drop it inside the Frame in the Xamarin UWP app.

Expected Behavior

The dropped file's full path get passed into the OnDrop event.

Actual Behavior

Raises exception in OnDrop: "System.ArgumentNullException: Value cannot be null.\r\nParameter name: view\r\n at Xamarin.Forms.DropEventArgs..ctor(DataPackageView view)\r\n at Xamarin.Forms.Platform.UWP.VisualElementTracker`2.HandleDrop(Object sender, DragEventArgs e)"

Information

  • IDE and IDE version: Visual Studio 2019 v16.8.6
  • Platform with the issue:
    • UWP: SDK 19041

Drag and Drop file from outside the App is very useful. Please help. Thanks a lot.

SunshineSpring666 avatar Feb 24 '21 08:02 SunshineSpring666

Were you able to fix the problem? I have exactly the same problem and could need some advice.

Hurricane31337 avatar Feb 13 '22 00:02 Hurricane31337

Sadly, no fix or workaround found. I've gave up on using this Drag and Drop functionality.

SunshineSpring666 avatar Feb 17 '22 04:02 SunshineSpring666