COMException error when dragging over Skype
Antonyo opened this issue · 4 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?
- Create a listbox with items referencing file path.
- Attach a Draghandler to the listbox and set is as DragSource.
- On StartDrag create a DataObject with FileDrop as data format and an string[] containing the paths of the selected files as data.
- 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