Registry Mirror
Skip to content

Conversation

@christophwille

Copy link
Copy Markdown
Member

Fixes #4054.

Symptom

Dragging a managed DLL from the search results of a third-party program such as FileLocator Pro onto the assembly list shows the no-drop cursor and the file is never opened. Dragging the same file from Windows Explorer works. ILSpy 10 (WPF) accepted both.

What was ruled out

The natural suspect was the data object. WPF's DataObject.GetDataPresent(DataFormats.FileDrop) asks the source via IDataObject::QueryGetData, while Avalonia's Win32 backend (OleDataObjectToDataTransferWrapper.ProvideFormats) builds its format list solely from IDataObject::EnumFormatEtc, so a source that serves CF_HDROP without enumerating it would be invisible to Avalonia. That is not the case here: a trace in SharpTreeView.OnDragOver showed FileLocator Pro enumerates CF_HDROP (DataFormat.File) plus Shell IDList Array, TryGetFiles() returns the item, and TryGetLocalPath() resolves the full path. AssemblyListTreeNode.CanDrop therefore returned true.

Actual cause

The effect negotiation. AssemblyListTreeNode.CanDrop answered DragOver with XPlatDragDropEffects.Move only. Avalonia passes that back to OLE as *pdwEffect, and OLE intersects it with the effects the drag source allowed in DoDragDrop. FileLocator Pro's source only permits DROPEFFECT_COPY (it offers files to read, not to move), so Move & Copy == None and Windows shows the no-drop cursor. Explorer permits Move/Copy/Link, which is why Explorer drops kept working and masked the bug. VS Code accepts these drags because it answers Copy.

The WPF AssemblyListTreeNode.CanDrop in ILSpy 10 answered Move | Copy | Link and let the source pick whichever it permits; the Avalonia port narrowed that to Move.

Fix

Offer Move | Copy | Link again in AssemblyListTreeNode.CanDrop. The effect only influences the cursor and the negotiation; Drop opens the files and moves them into position regardless of which effect was chosen, so the internal reorder drag is unaffected.

Verified manually with FileLocator Pro and Explorer; AssemblyTreeFileDropTests pass.

The assembly list answered DragOver with the Move effect only. OLE
intersects that answer with the effects the drag source permits, and
sources such as FileLocator Pro only permit Copy, so the negotiation
ended in None and the drop was refused although CF_HDROP was present
and the file path resolved fine. Explorer permits Move, which is why
drops from Explorer kept working. The WPF ILSpy offered Move, Copy and
Link and let the source pick; restore that.

Assisted-by: Claude:claude-fable-5:Claude Code
@christophwille
christophwille merged commit 27b45a4 into master Aug 26, 2026
15 checks passed
@christophwille
christophwille deleted the fix/external-drop-effects branch August 26, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag & Drop from Non-Explorer Windows no longer works

1 participant