Bug 13175 - clipboard malfunction on paste
Summary: clipboard malfunction on paste
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 4.0.9
Hardware: PC Windows
: High normal
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2013-07-11 09:39 UTC by eduard.qualls
Modified: 2013-07-12 03:07 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description eduard.qualls 2013-07-11 09:39:06 UTC
There appears to be a memory leak, pointer offset problem, or cumulative char-counting error in the clipboard code.


A. After a period of use, copy/paste from XS text editor into XS editor will start pasting extra copies of the ending characters of copied text into the target window. (It pastes the correct, copied text, but then 'backtracks' and extends the paste by re-pasting the last {n} characters.) The count of those extra characters increases with each copy/paste cycle.

This may also be related to the problem that, if you copy text from the XS text editor into Eclipse or Visual Studio [but not Notepad, Wordpad, Word, or OpenOffice], you get a blank line inserted between each original line of text. [Looks like the code could be doing extra EOL appends: CR/LF => CR/LF/LF, etc., that the text editors, but not the code editors, are handling, and this is throwing the length calculation off.]

B. My copy of XS just sent two automated error reports from its barfing on pasting lines copied from Chrome.

Note that after doing those trial pastes (above) into Eclipse & VS, the error vanishes.

However, after going back and doing one copy/paste from XS to XS, then copying from Chrome into XS, one of two things happens:
1) pasting into XS is corrupted, but doesn't throw an exception, or
2) XS throws an exception.

Number 2 happened after copying the "using System.Runtime.Serialization.Formatters.Binary;" (full) line from http://msdn.microsoft.com/en-us/library/system.runtime.serialization.iserializable.getobjectdata.aspx, and trying to paste it into XS. Here's the exception report:

System.ArgumentException: Source array was not long enough. Check srcIndex and length, and the array's lower bounds.
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at Mono.TextEditor.ClipboardActions.<>c__DisplayClass4.<PasteFrom>b__0(Clipboard clp, SelectionData selectionData)
   at GtkSharp.ClipboardReceivedFuncWrapper.NativeCallback(IntPtr clipboard, IntPtr selection_data, IntPtr data)
Comment 1 Mike Krüger 2013-07-12 03:07:09 UTC