We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Clipboard error

Hi there,
We are using Syncfusion Essential Studio WPF v7.3.0.2

In Syncfusion GridControl which being used to display the static cells, when we click on the row in the grid often (not all the times) it is throwing exception. How can we avoid this exception? see the exception below for details.

Type:System.Runtime.InteropServices.COMException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))
Source : mscorlib
Help link :
ErrorCode : -2147221040
Data : System.Collections.ListDictionaryInternal
TargetSite : Void ThrowExceptionForHRInternal(Int32, IntPtr)
Stack Trace : at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Windows.Clipboard.GetDataObjectInternal()
at Syncfusion.Windows.Controls.Grid.GridModelCutPaste.CanPaste()
at Syncfusion.Windows.Controls.Grid.GridControl.OnCanExecutePaste(CanExecuteRoutedEventArgs args)
at System.Windows.Input.CommandBinding.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.RoutedCommand.CanExecuteImpl(Object parameter, IInputElement target, Boolean trusted, Boolean& continueRouting)
at System.Windows.Input.CommandManager.TransferEvent(IInputElement newSource, CanExecuteRoutedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.RoutedCommand.CanExecuteImpl(Object parameter, IInputElement target, Boolean trusted, Boolean& continueRouting)
at System.Windows.Input.RoutedCommand.CanExecute(Object parameter, IInputElement target)
at MS.Internal.Commands.CommandHelpers.CanExecuteCommandSource(ICommandSource commandSource)
at System.Windows.Controls.Primitives.ButtonBase.OnCanExecuteChanged(Object sender, EventArgs e)
at System.Windows.Input.CommandManager.CallWeakReferenceHandlers(List`1 handlers)
at System.Windows.Input.CommandManager.RaiseRequerySuggested(Object obj)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(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, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
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.TranslateAndDispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunInternal(Window window)

7 Replies

CB Clay Burch Syncfusion Team October 2, 2009 01:21 PM UTC

I searched our support DataBase looking for any other reports on such an exception and was not able to find one.

I also did a simple sample with a GridControl using all Static CellTypes and could not reproduce the exception clicking around the grid. What other settings were you using that might afffect this? Are you trying to copy/paste anything when the exception is raised?

Can you tell us how to see this exception in one of the samples we ship, or can you upload a sample showing issue? If you do not want to upload a sample here, you can create a Direct Trac support incident and you can upload the sample there.


DV Dhanasekaran Veluchamy October 6, 2009 07:25 AM UTC

I am using setting these properties.
gridControl.Model.Options.ShowCurrentCell = false;
gridControl.Model.Options.ScrollFrozen = true;
gridControl.Model.Options.AllowSelection = GridSelectionFlags.Row;
gridControl.Model.Options.ListBoxSelectionMode = GridSelectionMode.One;
gridControl.Model.Options.DrawSelectionOptions = GridDrawSelectionOptions.AlphaBlend | GridDrawSelectionOptions.ReplaceBackground | GridDrawSelectionOptions.ReplaceTextColor;
gridControl.Model.Options.HighlightSelectionBackground = new SolidColorBrush( Color.FromArgb( 0xFF, 0xDF, 0xB3, 0x2A ) );
gridControl.Model.Options.HighlightSelectionForeground = Brushes.White;

And we have a tool bar icons(cut, copy & paste) which enable/disable themselves based on the focused control, that is using the commands Cut, Copy & Paste respectively. I suppose when clicking on the GridControl the command (Paste) evaluates whether the control is allowed paste or not. That time it throwing this exception.

I hope this helps to resolve the issue.


CB Clay Burch Syncfusion Team October 7, 2009 07:20 AM UTC

>> which enable/disable themselves based on the focused conttrol

Is it your code that does this work of enabling and disabling? If so, can you place it inside a try catch block to see if it will avoid this issue? In you catch block, if the exception arises, assume the control does not support copy/paste.



DV Dhanasekaran Veluchamy October 8, 2009 06:28 AM UTC

We are not trying to enable/disable through code. we have assigned the commands Cut, Copy & Paste to three separate tool bar buttons.
I meant that command should be evaluating the enable/disable buttons for the focused control (GridControl static cell in this case).

And this exception occurs only on first time application load after user logged in to the system.

Hope this suffices to resolve the issue.


CB Clay Burch Syncfusion Team October 8, 2009 07:28 AM UTC

We have added a try-catch block in our CanPaste code to avoid an uncaught exception if the Clipboard is unavailable (this error is thrown) for any reason. This code change will be in the Vol4 release scheduled at the end of this month. If you want to get access to a development build with this fix in it to check it for your case, you can create a Direct Trac support incident and request one.


DV Dhanasekaran Veluchamy February 22, 2010 10:33 AM UTC

Hi, I have tried by downloading the Vol4 libraries but still the same error occurs. Please do the needful.


MS Mohamed Suhaib Fahad A. Syncfusion Team March 3, 2010 04:20 AM UTC

Hi Dhanasekar,

Can you please create a Direct Trac incident for this forum, We would like to follow up on that.

Thanks,
Fahad

Loader.
Live Chat Icon For mobile
Up arrow icon