This is a migrated thread and some comments may be shown as answers.

App crash when dropping into WordPad

17 Answers 108 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Lynne
Top achievements
Rank 1
Lynne asked on 24 Oct 2011, 02:53 PM
I'm getting an application crash when I drag a row from a RadGridView and drop it into an open doc in WordPad.  I don't get a crash when I drop it into an open doc in Notepad, Word 2003, or Excel 2003.  Drag and drop within the application seems to work fine.

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

Sort by
0
Vlad
Telerik team
answered on 26 Oct 2011, 07:10 AM
Hello,

 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 >>

0
Lynne
Top achievements
Rank 1
answered on 26 Oct 2011, 01:39 PM
I'm not sure I understand your response, and wonder if it was misfiled.

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.
0
Vlad
Telerik team
answered on 26 Oct 2011, 01:43 PM
Hi,

 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 >>

0
Lynne
Top achievements
Rank 1
answered on 07 Dec 2011, 07:34 PM
Bump.  This is still happening.  If I drag something out of a RadGridView and drop it in an external application, *MY* application crashes.

Definitely need a solution to this, since I have *no* way of preventing this that I'm aware of.
0
Lynne
Top achievements
Rank 1
answered on 07 Dec 2011, 07:51 PM
Exception details below.  It doesn't happen with every external application.

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: 

0
Tsvyatko
Telerik team
answered on 12 Dec 2011, 11:09 AM
Hello Lynne,

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 >>

0
Tsvyatko
Telerik team
answered on 12 Dec 2011, 11:10 AM
Hello Lynne,

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 >>

0
Lynne
Top achievements
Rank 1
answered on 12 Dec 2011, 03:40 PM
I don't *want* to drag and drop anything into any application, so this won't be any help.

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?
0
AndyRutter
Top achievements
Rank 2
answered on 31 Mar 2012, 04:34 PM
I would like to know this too, why did this thread go dead?
0
Nick
Telerik team
answered on 04 Apr 2012, 12:14 PM
Hi all,

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! 

Greetings,
Nik
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Bill
Top achievements
Rank 1
answered on 04 Apr 2012, 06:52 PM
Is it really the case that an OS component causes a drag-source app to crash if the drag-target app is somehow unsuitable to receive the dropped object? 

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
0
Lynne
Top achievements
Rank 1
answered on 04 Apr 2012, 07:18 PM
Yes, it seems to be that way.  No amount of exception handling seemed to cope with this, and the generally unsatisfactory answer(s) I got lead me to have update our docs with the instructions: "If you drag something into an external app and our app crashes, don't do that."

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.
0
Bill
Top achievements
Rank 1
answered on 04 Apr 2012, 08:04 PM
Hi Lynne,

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
0
Lynne
Top achievements
Rank 1
answered on 04 Apr 2012, 08:07 PM
IIRC, Telerik suggested that using their new DnD component was the right way to go, rather than this (an older component).  I originally started using it because the documentation suggested it, because it hadn't been updated, or I missed some critical line of text somewhere.

Right now, for us, "Don't do that," is going to have to be good enough.
0
Bill
Top achievements
Rank 1
answered on 05 Apr 2012, 01:27 AM
Someone else reports what seems to be a similar error, but it is not the same use case:

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


0
Nick
Telerik team
answered on 05 Apr 2012, 09:21 AM
Hello,

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
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Bill
Top achievements
Rank 1
answered on 05 Apr 2012, 03:47 PM
Hi Nik,

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

Bill

Tags
DragAndDrop
Asked by
Lynne
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Lynne
Top achievements
Rank 1
Tsvyatko
Telerik team
AndyRutter
Top achievements
Rank 2
Nick
Telerik team
Bill
Top achievements
Rank 1
Share this question
or