Exception:
- {"Error HRESULT E_FAIL has been returned from a call to a COM component."}
- -2147467259
Here's the stack trace:
- at MS.Win32.UnsafeNativeMethods.DoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
- at System.Windows.OleServicesContext.OleDoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
- at System.Windows.DragDrop.OleDoDragDrop(DependencyObject dragSource, DataObject dataObject, DragDropEffects allowedEffects)
- at System.Windows.DragDrop.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects)
- at Telerik.Windows.DragDrop.DragDropManager.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects, DragDropKeyStates initialKeyState, Object dragVisual, Point relativeStartPoint, Point dragVisualOffset) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\DragDropManager\DragDropManager.cs:line 1012
17 Answers, 1 is accepted
Thanks for the report! We will fix the demo for our official Q3 2011 release (middle of November).
Best wishes,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

I didn't report anything related to a demo. An exception in the Telerik code crashes my app under the DnD scenario described in my original message.
Indeed the crash was because wrong implementation in the demo.
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Definitely need a solution to this, since I have *no* way of preventing this that I'm aware of.

Notepad - no crash
Wordpad - crash
System.Runtime.InteropServices.COMException was unhandled
Message=Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))
Source=WindowsBase
ErrorCode=-2147221404
StackTrace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Windows.DataObject.System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& formatetc, STGMEDIUM& medium)
at MS.Win32.UnsafeNativeMethods.DoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
at System.Windows.OleServicesContext.OleDoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
at System.Windows.DragDrop.OleDoDragDrop(DependencyObject dragSource, DataObject dataObject, DragDropEffects allowedEffects)
at System.Windows.DragDrop.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects)
at Telerik.Windows.DragDrop.DragDropManager.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects, DragDropKeyStates initialKeyState, Object dragVisual, Point relativeStartPoint, Point dragVisualOffset) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\DragDropManager\DragDropManager.cs:line 1012
at Telerik.Windows.DragDrop.DragInitializer.StartDrag() in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\DragDropManager\DragInitializer.cs:line 179
at Telerik.Windows.DragDrop.DragInitializer.DragSourcePreviewMouseMove(Object sender, MouseEventArgs e) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\DragDropManager\DragInitializer.cs:line 155
at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at ccm3.App.Main() in F:\PredatorGames\src\ccm3\trunk\ccm3\obj\x86\Debug\App.g.cs:line 0
InnerException:
Here is example of how to provide dragObject that is suitable for text editors (such as wordpad). Please, have a look and let us know if this fit to your sceanrio.
Greetings,Tsvyatko
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Here is example of how to provide dragObject that is suitable for text editors (such as wordpad). Please, have a look and let us know if this fit to your sceanrio.
Tsvyatko
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

I don't want my application to crash if a user drags and drops something outside the window. How can I prevent a user from dragging anything outside the bounds of my main window?

Unfortunately, when dragging between different applications, the Drag & Drop operation is being handled by an OS service, which provides notifications for the participating applications. Therefore there currently isn't a viable solution to the problem at hand. A possible way to restrict the Drag & Drop is to convert the application to partial trust.
We are sorry for any inconvenience caused!
Nik
the Telerik team

Should this not simply result in the drop pointer indicating a drop is not possible and if the user releases the button, the drop quietly doesn't happen?
Thanks,
Bill

Fortunately, our DnD is internal only, so it's reasonably unlikely that this won't happen, and indeed, I found it only by accident.
I don't understand the trust issue, so I can't address that.
The real solution is that we need to convert our app to not use this component, but time constraints have made this difficult.

I was responding to what seemed to be the suggestion that this was not an issue limited to the telerik DnD component, but rather, something tied to the OS service that handles inter-process DnD.
Aside from that, even though you are not /looking/ to provide DnD to Wordpad or elsewhere, was there anything in Tsvyatko's reply that suggests a different approach from what you were already doing? Maybe you can provide a "dummy" drop value (ie, something empty or simple) that will satisfy additional drop targets and at least prevent the crash?
Just a thought. I am just beginning to look into using the telerik DnD module in my app. Also, Tsvyatko's example uses the older telerik:RadDragAndDropManager - I think the newer one is just called telerik:DragAndDropManager; VS2010/Telerik extension notified me that the project used an older version of some components than that which was available on my system.
Bill

Right now, for us, "Don't do that," is going to have to be good enough.

http://www.telerik.com/community/forums/wpf/draganddrop/dragdropmanager-might-result-error-hresult-e-fail-has-been-returned-from-a-call-to-a-com-component.aspx
They are using the newer DragDropManager from Q3 2011.
Bill
We introduced some changes in the DragDropManager. You can drag and drop freely anywhere, just when the OS service reports an error (COM exception), your applications won't crash.
The fix will be available in our internal build next week. Again, we are sorry for any inconvenience caused!
Regards,
Nik
the Telerik team

Thank you for the update. Its great to hear that telerik has been able to reproduce this and create a fix!
Bill