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

OpenClipboard Failed Exception in Telerik.Windows.Controls.FixedDocumentViewerBase

1 Answer 681 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Cale
Top achievements
Rank 1
Cale asked on 05 Sep 2018, 10:29 PM

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)

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 10 Sep 2018, 08:02 AM
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.
Tags
General Discussions
Asked by
Cale
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or