punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

COMException error when dragging over Skype

Antonyo opened this issue · comments

Hello, we're developing an application using your component and when a listbox item is dragged onto an Skype conversation a COMException is thrown with the following message: "Error HRESULT E_FAIL has been returned from a call to a COM component." and the application closes. In our case the listbox contains references to file so the data format is FileDrop and the data is the list of selected files referenced in the listbox items.

This is not an issue with your component, it also happen implementing our own drag handler using the System.Windows.DragDrop class so it should be a problem with wpf, what I need is some way to intercept the exception because right now the exception occurs outside the draghandler, I provide below some information about where exactly happen.

I have a commit in my own fork that I can create a pull request out of it: https://github.com/Antonyo/gong-wpf-dragdrop/commit/fba7375e31fa6161aaff1f6e06a96d5160f57231

What steps will reproduce the problem?

  1. Create a listbox with items referencing file path.
  2. Attach a Draghandler to the listbox and set is as DragSource.
  3. On StartDrag create a DataObject with FileDrop as data format and an string[] containing the paths of the selected files as data.
  4. Drag a listbox item onto an skype conversation.

What is the expected output? What do you see instead?

A COMException is thrown with the following message: "Error HRESULT E_FAIL has been returned from a call to a COM component." and the application closes. The skype window correctly attaches the file but the exception shouldn't be thrown.

What version of the product are you using? On what operating system?

I'm using the 0.1.4.3 version and Skype 7.7.64.103 over Windows 8.1.

Please provide any additional information below.

The exception occurs here: https://github.com/punker76/gong-wpf-dragdrop/blob/master/GongSolutions.Wpf.DragDrop/DragDrop.cs#L796

I found an article with a similar scenario but in our case we're actually using the correct FileDrop format:
http://stackoverflow.com/questions/19775784/error-hresult-e-fail-has-been-returned-from-a-call-to-a-com-component-when-try

@Antonyo I think the best will be a try catch, if it's a WPF problem maybe you should tell Microsoft. I've created a PR which should fix this issue by catching the exception

Hi @SuicSoft thanks for the info, I actually changed it in my fork, you can see it here: fba7375

I added a handler so I can display an error message in my program rather than swallow the exception.

Hi @Antonyo .How about creating a PR for that. Then we can chose whether to show a message or just ignore it. Closes #152

@Antonyo Hi, I take your changes and pushes a new alpha version (gong-wpf-dragdrop 1.0.0-ALPHA012). I changed only the name of the method. Thx for your effort! 👏