[Mono-bugs] [Bug 503174] New: Can not paste or insert RTF text to a RichTextBox control.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 12 14:43:15 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=503174


           Summary: Can not paste or insert RTF text to a RichTextBox
                    control.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: i686
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: slikktic at yahoo.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


Created an attachment (id=291684)
 --> (http://bugzilla.novell.com/attachment.cgi?id=291684)
Test application to reproduce the exception.

Description of Problem: 
 You can not Paste rtf text in to the RichTextBox control.  Notice this issue
when I was copy text from visual studios code in to a mono richtextbox control
and it crashed the application.  The following is the stack trace:

System.ArgumentOutOfRangeException: Valid values are between 0 and 65535,
inclusive.
Parameter name: codepage
  at System.Text.Encoding.GetEncoding (Int32 codepage) [0x0016e] in
C:\cygwinM\usr\src\mono-2.2\mcs\class\corlib-2.4\System.Text\Encoding.cs:523 
  at System.Windows.Forms.RTF.RTF.GetToken () [0x0007e] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms.RTF\RTF.cs:373 
  at System.Windows.Forms.RTF.RTF.ReadFontTbl (System.Windows.Forms.RTF.RTF
rtf) [0x00226] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms.RTF\RTF.cs:763 
  at System.Windows.Forms.RTF.RTF.RouteToken () [0x00025] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms.RTF\RTF.cs:323 
  at System.Windows.Forms.RTF.RTF.Read () [0x00005] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms.RTF\RTF.cs:311 
  at System.Windows.Forms.RichTextBox.InsertRTFFromStream (System.IO.Stream
data, Int32 cursor_x, Int32 cursor_y, System.Int32& to_x, System.Int32& to_y,
System.Int32& chars) [0x00110] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\RichTextBox.cs:1824 
  at System.Windows.Forms.RichTextBox.set_SelectedRtf (System.String value)
[0x0005f] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\RichTextBox.cs:410 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.RichTextBox:set_SelectedRtf (string)
  at MonoTestRichTxt.RichTxtTestFrm.TestBtn_Click (System.Object sender,
System.EventArgs e) [0x00000] 
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x0001c] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:6033 
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x00024] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Button.cs:106 
  at System.Windows.Forms.ButtonBase.OnMouseUp
(System.Windows.Forms.MouseEventArgs mevent) [0x00081] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\ButtonBase.cs:634 
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs
mevent) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Button.cs:128 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m)
[0x00081] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:5595 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
[0x0017c] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:5332 
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m)
[0x00055] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\ButtonBase.cs:692 
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m)
[0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Button.cs:150 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:234 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:215 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x00085] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows.Forms\NativeWindow.cs:242 




Steps to reproduce the problem:
1. Compile the attached program.cs file.
2. Run the application.
3. Click on the Test button. This calls the following function:
            string rtfTest = @"{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1
\deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier
New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;}\fs20
\cf2 string\cf0  test}";
            richTextBox1.SelectedRtf = rtfTest;


Actual Results:
 Crashes the application.

Expected Results: 
 Should allow me to paste the text, or throw an error message saying it is not
allowed.  It shouldn't crash the application.


How often does this happen? Always.


Additional Information: 
  Attached is a test application that doesn't Paste the rtf, it just uses the
RichTextBox.SelectedRtf property to set the rtf, which also produces the same
exception.  These work in regular .net 2.0 framework, but not in mono 2.4.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list