Possible issue with pasting text

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Ashton - Developer, Schema Solutions LLC
When I paste text into my application, on occassion, I will get the following error:

Type: System.Runtime.InteropServices.ExternalException
Message: The requested clipboard operation failed.
Source: System.Windows.Forms
Stack Trace: at System.Windows.Forms.Clipboard.ThrowIfFailed(Int32 hr)
at System.Windows.Forms.Clipboard.GetDataObject()
EditCommandContext context)
at ActiproSoftware.SyntaxEditor.MacroRecording._1(EditCommand ,
EditCommandContext )
at ActiproSoftware.SyntaxEditor.EditorView._1(EditCommand , Boolean )
at ActiproSoftware.SyntaxEditor.SyntaxEditor._1(EditorView , Keys ,
Char , Boolean )
at ActiproSoftware.SyntaxEditor.SyntaxEditor.OnKeyDown(KeyEventArgs
at CustomEditorClass.OnKeyDown(KeyEventArgs A_0)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at ActiproSoftware.SyntaxEditor.SyntaxEditor.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Is there any obvious reason why I might be getting this issue when I paste data? It looks like it is occurring where I call the base.OnKeyDown(e) method in my overriden KeyDown, but not sure what the rest of the stack trace indicates.

I am using Build 181.



Comments (3)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
It's happening in Microsoft's code. We've run into goofy things with the Clipboard where sometimes Cut/Copy operations on Microsoft's clipboard classes would blow up for unknown reasons. So we have a try...catch around it there and retry a second time if it fails. If you Google that error message you see that other people have run into it too.

Other than adding similar logic to Paste where we try...catch our Clipboard.GetDataObject() call and try it a second time in the catch, I'm not sure what we can do since this is a Microsoft bug in the framework.

Actipro Software Support

Posted 19 years ago by Ashton - Developer, Schema Solutions LLC
Yeah, I've seen similar issues.

The Macro event made me suspicious since I wasn't recording a macro at the time.


Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
It just runs all commands through the macro service and records them only if you are in recording mode. Nothing big there...

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.