Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mono: crash on an attempt to "Copy commit info" #3729

Closed
l-inc opened this issue May 27, 2017 · 4 comments
Closed

mono: crash on an attempt to "Copy commit info" #3729

l-inc opened this issue May 27, 2017 · 4 comments
Milestone

Comments

@l-inc
Copy link

l-inc commented May 27, 2017

My current setup includes current GitExtensions' master, mono 5.0.1.1, Cinnamon, Fedora 25, where this bug is also reproducible.
copy-commit-info-crash
An attempt to "Copy commit info" using the context menu shown above (or the same one from the commit "Diff" window) leads to the following crash on mono:

System.DllNotFoundException: user32
  at (wrapper managed-to-native) GitUI.Editor.RichTextBoxExtension.RichTextBoxXhtmlSupportExtension+NativeMethods:SendMessage (System.Runtime.InteropServices.HandleRef,int,intptr,intptr)
  at GitUI.Editor.RichTextBoxExtension.RichTextBoxXhtmlSupportExtension.BeginUpdate (System.Runtime.InteropServices.HandleRef handleRef) [0x00001] in <e841d986a1f84ab8b0be01a7d62247d9>:0 
  at GitUI.Editor.RichTextBoxExtension.RichTextBoxXhtmlSupportExtension.BeginUpdate (System.Windows.Forms.RichTextBox rtb) [0x0000f] in <e841d986a1f84ab8b0be01a7d62247d9>:0 
  at GitUI.Editor.RichTextBoxExtension.RichTextBoxXhtmlSupportExtension.GetPlaintText (System.Windows.Forms.RichTextBox rtb) [0x00001] in <e841d986a1f84ab8b0be01a7d62247d9>:0 
  at GitUI.CommitInfo.CommitInfo.copyCommitInfoToolStripMenuItem_Click (System.Object sender, System.EventArgs e) [0x00001] in <e841d986a1f84ab8b0be01a7d62247d9>:0 
  at System.Windows.Forms.ToolStripItem.OnClick (System.EventArgs e) [0x00019] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.ToolStripMenuItem.OnClick (System.EventArgs e) [0x00090] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.ToolStripMenuItem.HandleClick (System.Int32 mouse_clicks, System.EventArgs e) [0x00000] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.ToolStripItem.FireEvent (System.EventArgs e, System.Windows.Forms.ToolStripItemEventType met) [0x00054] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ToolStripItem:FireEvent (System.EventArgs,System.Windows.Forms.ToolStripItemEventType)
  at System.Windows.Forms.ToolStrip.OnMouseUp (System.Windows.Forms.MouseEventArgs mea) [0x00048] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.ToolStripDropDown.OnMouseUp (System.Windows.Forms.MouseEventArgs mea) [0x00000] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.ToolStrip.WndProc (System.Windows.Forms.Message& m) [0x00000] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.ToolStripDropDown.WndProc (System.Windows.Forms.Message& m) [0x00017] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <298fc9b739c74aebb706be1d082ed5e4>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <298fc9b739c74aebb706be1d082ed5e4>:0 
@RussKie
Copy link
Member

RussKie commented Jun 5, 2017

It doesn't seem it is possible at all to set data in clipboard in Mono and then paste it to a native app...
e.g. http://mono.1490590.n4.nabble.com/Status-of-Copy-and-Paste-Clipboard-integration-with-OS-X-td1548902.html

I got it working on Mac with the code from here https://stackoverflow.com/questions/28611112/mono-clipboard-fix.
However I don't think this will work on linux, as it appears pbcopy is only available on Mac...

There's also presumably a way to achieve xplat copy/paste functionality via GTK clipboard https://www.medo64.com/2011/01/mono-ubuntu-and-clipboard/
But I couldn't find where to get the GtkClipboard.dll.

On the Mac I couldn't copy text via the native context menu or via Command+C and then paste it in a Mac app at all...
screen shot 2017-06-05 at 11 22 00 pm

If there is a command to copy text on *nix via command line (the same way as for the Mac) - we can probably fix it. Else - we will need to disable all "copy" context menus on *nix.

@l-inc
Copy link
Author

l-inc commented Jun 5, 2017

Copying from the commit tree (right click on a commit -> Copy to clipboard -> < any menu item >) works perfectly for me on mono. With respect to this particular issue report, it's just not the best idea to use Win32 API, if GitExtensions is meant to be portable.

@RussKie
Copy link
Member

RussKie commented Jun 6, 2017

great, it doesn't work on a mac then... sigh
i'll make tweaks and push them for you to test

@l-inc
Copy link
Author

l-inc commented Jun 10, 2017

Thanks a lot. #3752 does indeed fix the crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants