Bug 36671 - Clipboard.SetText("..."); Does not work
Summary: Clipboard.SetText("..."); Does not work
Status: REOPENED
Alias: None
Product: Gtk#
Classification: Mono
Component: other ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-12-07 11:58 UTC by Roman
Modified: 2017-12-06 07:58 UTC (History)
5 users (show)

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


Attachments
Example of Clipboard working (7.76 KB, application/octet-stream)
2017-05-23 14:05 UTC, Roman
Details


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 for Bug 36671 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
REOPENED

Description Roman 2015-12-07 11:58:03 UTC
After call method Clipboard.SetText my clipboard stays empty
Comment 1 João Matos 2015-12-07 17:23:08 UTC
We have some code to handle this per-platform.

https://github.com/mono/mono/blob/master/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUI.cs

https://github.com/mono/mono/blob/master/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11GTK.cs

The Mono team is not actively fixing bugs on the System.Windows.Forms code, so if you really need this feature I suggest you send a pull request with the bug fixes and we will get them reviewed and integrated.
Comment 2 Roman 2015-12-07 18:51:33 UTC
I'm sorry. I have just understood some details.
Really Clipboard.SetText works but only if I throw data from clipboard to monodevelop in text editor it nothing happens and if I throw data from clipboard to other text editors (leafpad for example) data is throwed.
In commons problem relates to monodevelop but not to System.Windows.Forms.
Comment 3 Kirill Osenkov 2017-05-15 23:02:09 UTC
Unfortunately we don't have enough information for now to investigate this, so we're resolving this bug. However clipboard is a very common operation and we'll be keeping an eye on this area and definitely will investigate if we notice anything.
Comment 4 Roman 2017-05-16 10:14:15 UTC
Create WinForms project with one textBox, open leafpad, run your application, type text in textBox of your application and copy it using Ctrl + C and paste it into leafpad using Ctrl + V. Next try reverse from leafpad to textBox of your application.

really does it take much time?
Comment 5 Kirill Osenkov 2017-05-16 23:15:09 UTC
Thanks for providing more details. I apologize for asking such simple things, but it would help if you could be more specific in your repro steps:

1. OS: Linux (which distro, version?)
2. Install which product from where (Xamarin Studio version ?? from ???)
3. Start XS.
4. In XS, create a new WinForms project, add a form, add a text box on the form
5. Open leafpad
6. Run your application, type text, copy using Ctrl+C and paste into leafpad using Ctrl+V
7. Expected results: should paste what you copied. Actual results: ???
8. Next try the reverse from leafpad to the textbox. Expected results: should paste. Actual results: ???

Without knowing which exact operating system you're using and which version of MonoDevelop/Xamarin Studio we can't investigate this further.

Additionally, if copying/pasting between the form and leafpad doesn't work, it most surely isn't a problem with Xamarin Studio or MonoDevelop, but rather, with the System.Windows.Forms implementation in the mono runtime, which, as João Matos mentions, is not officially supported.

Here's a question: when you compile a simple WinForms app with a textbox on Windows, and then run it on Linux, does it work? If yes, then MonoDevelop build might be involved. But if it doesn't, then it has nothing to do with MonoDevelop and we unfortunately don't support this scenario.

Thanks again for your patience.
Comment 6 Roman 2017-05-17 07:19:38 UTC
I will create project for you today
Comment 7 Roman 2017-05-23 14:05:50 UTC
Created attachment 22392 [details]
Example of Clipboard working

There are two button and one text field
first button sets text from text field to clipboard (than try paste on leafpad forexample).
second button receives text from clipboard to text field (copy text from leafpad before, forexample)
Comment 8 Roman 2017-05-23 14:07:03 UTC
My OS Linux Mint 17.3 KDE
Monodevelop 5.10
mono 5.0.0.100
Comment 9 Kirill Osenkov 2017-05-23 20:03:22 UTC
This is not a MonoDevelop bug. It might be a bug in GTK for Linux.
Comment 10 Roman 2017-05-23 20:22:26 UTC
But I have not said that it is monodevelop bug. Look at the code in attachment. I use there class Clipboard from System.Windows.Forms namespace