WinForms applications crash when a specific text is pasted into any control that can accept text.
I just wanted to paste a piece text from Wikipedia in a Winforms application.
A similar bug reported in the xamarin bug tracker but no progress with it since 2017: https://xamarin.github.io/bugzilla-archives/60/60819/bug.html
Steps to Reproduce
- Paste following text into any RichTextControl, Textbox or anything that accepts pasted text: "Benzo[a]pyrene is a polycyclic aromatic hydrocarbon and the result of incomplete combustion of organic matter at temperatures between 300 °C (572 °F) and 600 °C (1,112 °F). The ubiquitous compound can be found in coal tar, tobacco smoke and many foods, especially grilled meats. " in a Winforms application. It even crashes if you paste into a file open dialog.
Apparently the issue is with the ° mark.
Current Behavior
It crashes.
Expected Behavior
It doesn't crash and is able to handle the conversion (even if that means including a � instead.)
On which platforms did you notice this
[ ] macOS [ X ] Linux [ ] Windows
Version Used:
Mono JIT compiler version 6.8.0.105 (tarball Tue Feb 4 21:20:20 UTC 2020) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug Interpreter: yes LLVM: yes(610) Suspend: hybrid GC: sgen (concurrent by default)
Stacktrace
System.ExecutionEngineException: String conversion error: Illegal byte sequence encounted in the input.
at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi(intptr)
at System.Windows.Forms.XplatUIX11.TranslatePropertyToClipboard (System.IntPtr property) [0x0005f] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.XplatUIX11.UpdateMessageQueue (System.Windows.Forms.XEventQueue queue, System.Boolean allowIdle) [0x00919] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.XplatUIX11.ClipboardRetrieve (System.IntPtr handle, System.Int32 type, System.Windows.Forms.XplatUI+ClipboardToObject converter) [0x0002f] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.XplatUI.ClipboardRetrieve (System.IntPtr handle, System.Int32 type, System.Windows.Forms.XplatUI+ClipboardToObject converter) [0x00000] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.Clipboard.GetDataObject (System.Boolean primary_selection) [0x00039] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.Clipboard.GetDataObject () [0x00000] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.TextBoxBase.ProcessKey (System.Windows.Forms.Keys keyData) [0x000a4] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.TextBoxBase.WndProc (System.Windows.Forms.Message& m) [0x0005b] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.TextBox.WndProc (System.Windows.Forms.Message& m) [0x0011c] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <69e4940ac30645898b9c63f67c310dba>:0
at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <69e4940ac30645898b9c63f67c310dba>:0 Source: mono/mono