Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when drag one file from Finder to App #15715

Open
Tenjim opened this issue May 14, 2024 · 5 comments
Open

Issue when drag one file from Finder to App #15715

Tenjim opened this issue May 14, 2024 · 5 comments
Labels

Comments

@Tenjim
Copy link

Tenjim commented May 14, 2024

Describe the bug

After Investigation, I have issue when we drag a file from Finder and drop on Avalonia App.
I'm using DragAndDrop Behavior from this repo. I have notice that when we do an DragEnter, we are looking to get a DataObject and there is en exception on Avalonia native clipboard:

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)

To Reproduce

Using DragAndDrop Behaviour, use it on an listbox.
Drag one file from Finder App to listboxItem.

Expected behavior

doing drop behavior

Avalonia version

11.0.10

OS

macOS

Additional context

No response

@Tenjim Tenjim added the bug label May 14, 2024
@timunie
Copy link
Contributor

timunie commented May 14, 2024

did you mark the thread as [STAThread]?

    [STAThread]
    public static void Main(string[] args)
 ...

@Tenjim
Copy link
Author

Tenjim commented May 14, 2024

HI @timunie ,
yes I did it on my main method

@timunie
Copy link
Contributor

timunie commented May 15, 2024

Can you do us a favor and test vanilla Avalonia Drag & Drop? I have no mac, so can't do it on my own. If you can reproduce there, upload the sample please

@Tenjim
Copy link
Author

Tenjim commented May 17, 2024

Hi I'll close this ticket, with investigation, it's came to DragAndDrop from Avalonia Xaml Behaviour. I'll follow up on his side. It's work well with vanilla Drag and drop

@Tenjim Tenjim closed this as completed May 17, 2024
@Tenjim Tenjim reopened this May 23, 2024
@Tenjim
Copy link
Author

Tenjim commented May 23, 2024

@timunie ,

As requested, I have reproduce that issue on my sample based on ControlCatalog from Avalonia samples here.

To see what I have, you need just to drag a file from finder on DragMeCustom Textblock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants