OpenClipboard Failed Exception in Telerik.Windows.Controls.FixedDocumentViewerBase

2 posts, 0 answers
  1. Cale
    Cale avatar
    5 posts
    Member since:
    Sep 2018

    Posted 05 Sep 2018 Link to this post

    COMException (OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))) in assembly mscorlib Void Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode IntPtr errorInfo)

    My application is unable to catch this exception because it happens in the application message loop.

    Can Telerik not handle this internally? Allowing the exception to continue up the call stack brings our application down.

    Here is the Call Stack:

    mscorlib Void Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode IntPtr errorInfo)
    mscorlib Void Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode IntPtr errorInfo)
    PresentationCore Void Windows.Clipboard.Flush()
    Telerik.Windows.Controls.FixedDocumentViewers Void Telerik.Windows.Controls.FixedDocumentViewerBase. b__5(String s)
    WindowsBase Object Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback Object args Int32 numArgs)
    WindowsBase Object MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source Delegate method Object args Int32 numArgs Delegate catchHandler)
    WindowsBase Void Windows.Threading.DispatcherOperation.InvokeImpl()
    mscorlib Void Threading.ExecutionContext.RunInternal(Threading.ExecutionContext executionContext Threading.ContextCallback callback Object state Boolean preserveSyncCtx)
    mscorlib Void Threading.ExecutionContext.Run(Threading.ExecutionContext executionContext Threading.ContextCallback callback Object state Boolean preserveSyncCtx)
    mscorlib Void Threading.ExecutionContext.Run(Threading.ExecutionContext executionContext Threading.ContextCallback callback Object state)
    WindowsBase Void Windows.Threading.DispatcherOperation.Invoke()
    WindowsBase Void Windows.Threading.Dispatcher.ProcessQueue()
    WindowsBase IntPtr Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd Int32 msg IntPtr wParam IntPtr lParam Boolean& handled)
    WindowsBase IntPtr MS.Win32.HwndWrapper.WndProc(IntPtr hwnd Int32 msg IntPtr wParam IntPtr lParam Boolean& handled)
    WindowsBase Object MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
    WindowsBase Object Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback Object args Int32 numArgs)
    WindowsBase Object MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source Delegate method Object args Int32 numArgs Delegate catchHandler)
    WindowsBase Object Windows.Threading.Dispatcher.LegacyInvokeImpl(Windows.Threading.DispatcherPriority priority TimeSpan timeout Delegate method Object args Int32 numArgs)
    WindowsBase IntPtr MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd Int32 msg IntPtr wParam IntPtr lParam)
    Windows.Forms IntPtr Windows.Forms.UnsafeNativeMethods.DispatchMessageW(Windows.Forms.NativeMethods MSG& msg)
    Windows.Forms Boolean Windows.Forms.Application ComponentManager.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID Int32 reason Int32 pvLoopData)
    Windows.Forms Void Windows.Forms.Application ThreadContext.RunMessageLoopInner(Int32 reason Windows.Forms.ApplicationContext context)
    Windows.Forms Void Windows.Forms.Application ThreadContext.RunMessageLoop(Int32 reason Windows.Forms.ApplicationContext context)
    PacsViewer Void Novarad.Pacs.PacsViewer.App.Main(String args)

  2. Boby
    Admin
    Boby avatar
    763 posts

    Posted 10 Sep 2018 Link to this post

    Hi Cale,

    Can you elaborate more on the scenario in which you get the exception? Judging from the call stack, it seems that you are doing copy operation in RadPdfViewer (for WPF), which is used in a WinForms application - can you confirm?

    If this is the case, we've had similar reports in the past, and it seems the underlying problem is in the Win32 API - the clipboard is locked exclusively per process and subsequent attempts to set text fails with the mentioned exception. You can read more in the following StackOverflow thread: CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET. More often than not, another process is blocking the clipboard for part of a second, and subsequent attempts to copy will succeed.

    Regards,
    Boby
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top