Avalonia.Xaml.Behaviors icon indicating copy to clipboard operation
Avalonia.Xaml.Behaviors copied to clipboard

(MacOS) Issue when DragEnter from Finder

Open Tenjim opened this issue 1 year ago • 3 comments

Hi,

I have an issue when I begin an DragEnter event to init the drag and drop from behavior. It's seems to came only when we drag a file from Finder. it's occur when we are getting custom data object type from clipboard. But it can't be replicated with vanilla Drag and drop from Avalonia. (ref : see ControlCatalog samples from Avalonia) because they are using DataFormat.File. fyi : it's only on macOS not on windows.

I'm using 11.0.10 (I had already try on 11.0.10.9) version of Avalonia Behavior And I'm on 11.0.10 Avalonia

This is the call stack about this issue :

System.Runtime.InteropServices.COMException (0x80004005): GetBytes failed at Avalonia.Native.Interop.Impl.__MicroComIAvnClipboardProxy.GetBytes(String type) at Avalonia.Native.ClipboardImpl.GetDataAsync(String format) at Avalonia.Native.ClipboardDataObject.Get(String dataFormat) at Avalonia.Xaml.Interactions.DragAndDrop.ContextDropBehavior.DragEnter(Object sender, DragEventArgs e)

Tenjim avatar May 17 '24 11:05 Tenjim

It's came from this issue on Avalonia

Tenjim avatar Jun 04 '24 09:06 Tenjim

I am going reopen this issue, as this library code should also be fixed by always checking if data format exists in the object: https://github.com/AvaloniaUI/Avalonia.Xaml.Behaviors/blob/master/src/Avalonia.Xaml.Interactions.DragAndDrop/ContextDropBehavior.cs#L76C60-L76C70 and other places.

maxkatz6 avatar Jun 20 '24 04:06 maxkatz6

I created PR #176 which fixes the issue.

ITDancer13 avatar Oct 03 '24 10:10 ITDancer13