App crash when dropping into WordPad

18 posts, 0 answers
  1. Lynne
    Lynne avatar
    40 posts
    Member since:
    Sep 2011

    Posted 24 Oct 2011 Link to this post

    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
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 26 Oct 2011 Link to this post

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

  3. UI for WPF is Visual Studio 2017 Ready
  4. Lynne
    Lynne avatar
    40 posts
    Member since:
    Sep 2011

    Posted 26 Oct 2011 Link to this post

    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.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 26 Oct 2011 Link to this post

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

  6. Lynne
    Lynne avatar
    40 posts
    Member since:
    Sep 2011

    Posted 07 Dec 2011 Link to this post

    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.
  7. Lynne
    Lynne avatar
    40 posts
    Member since:
    Sep 2011

    Posted 07 Dec 2011 Link to this post

    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: 

  8. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 12 Dec 2011 Link to this post

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

  9. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 12 Dec 2011 Link to this post

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

  10. Lynne
    Lynne avatar
    40 posts
    Member since:
    Sep 2011

    Posted 12 Dec 2011 Link to this post

    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?
  11. AndyRutter
    AndyRutter avatar
    32 posts
    Member since:
    Mar 2009

    Posted 31 Mar 2012 Link to this post

    I would like to know this too, why did this thread go dead?
  12. Nick
    Admin
    Nick avatar
    593 posts

    Posted 04 Apr 2012 Link to this post

    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 >>
  13. Bill
    Bill avatar
    9 posts
    Member since:
    Mar 2012

    Posted 04 Apr 2012 Link to this post

    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
  14. Lynne
    Lynne avatar
    40 posts
    Member since:
    Sep 2011

    Posted 04 Apr 2012 Link to this post

    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.
  15. Bill
    Bill avatar
    9 posts
    Member since:
    Mar 2012

    Posted 04 Apr 2012 Link to this post

    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
  16. Lynne
    Lynne avatar
    40 posts
    Member since:
    Sep 2011

    Posted 04 Apr 2012 Link to this post

    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.
  17. Bill
    Bill avatar
    9 posts
    Member since:
    Mar 2012

    Posted 04 Apr 2012 Link to this post

    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


  18. Nick
    Admin
    Nick avatar
    593 posts

    Posted 05 Apr 2012 Link to this post

    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 >>
  19. Bill
    Bill avatar
    9 posts
    Member since:
    Mar 2012

    Posted 05 Apr 2012 Link to this post

    Hi Nik,

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

    Bill

Back to Top
UI for WPF is Visual Studio 2017 Ready