[Mono-bugs] [Bug 80994][Maj] New - NullReferenceExeption inside RichTextBox

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Mar 1 14:50:42 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by linux.sarge at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80994

--- shadow/80994	2007-03-01 14:50:42.000000000 -0500
+++ shadow/80994.tmp.17894	2007-03-01 14:50:42.000000000 -0500
@@ -0,0 +1,114 @@
+Bug#: 80994
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: Service Pack 2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: linux.sarge at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceExeption inside RichTextBox
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+
+Description of Problem:
+
+First: Sorry for my bad english...
+Here is a screenshot of the bug:
+http://cyberstudio.110mb.com//MonoBugs/ScreenHunter_1.jpg
+
+Ok, Lets gonna say that you need to scan a RichTextBox Text property in
+search of every "A" in the text. When you find it you need to put it in
+Bold, Underline and Blue color. My approach runs well under .net 1.1 and
+2.0, But mono fails. Here is a small console program that reproduces de
+bug. just compile it with references to:
+
+*System
+*System.Windows.Forms 
+*System.Drawing
+
+Ok, here is the program:
+========================================
+
+using System;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace MonoBugC
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            Console.WriteLine();
+            Console.WriteLine("------------------------------------------");
+            Console.WriteLine("Press any key to start the bug");
+            Console.WriteLine("------------------------------------------");
+            Console.WriteLine();
+
+            //Create the objet and set his properties
+            RichTextBox myRtb = null;
+            myRtb = new RichTextBox();
+            myRtb.Font = new Font("Tahoma", 10, FontStyle.Regular);
+            myRtb.Text = " THIS IS A TEXT TO SHOW A BUG IN RICHTEXTBOX IN
+MONO";
+
+            //Scan the text and put in Bold, Underline and Blue every "A"
+in the text
+            for (int i = 0; i < myRtb.Text.Length; i++)
+            {
+
+                if (myRtb.Text[i].ToString()=="A")
+                {
+
+                    myRtb.SelectionStart = i;
+                    myRtb.SelectionLength = 1;
+
+                    FontStyle newFontStyle;
+                    newFontStyle = FontStyle.Bold;
+
+
+                    myRtb.SelectionFont = new Font("Tahoma", 10, newFontStyle);
+                    myRtb.SelectionColor = Color.Blue;
+                    myRtb.SelectionFont = new Font(myRtb.SelectionFont,
+myRtb.SelectionFont.Style ^
+                                                   FontStyle.Underline);
+                }
+            }
+
+            Console.WriteLine("Test passed :D, There is no bug!. Maybe you
+are running this program under\n"+
+                              "Microsoft .net Framework, or under mono
+version with the bug already fixed!");
+            Console.ReadLine();
+        }
+    }
+}
+
+
+
+
+
+Actual Results:
+NullReferenceExeption
+
+Expected Results:
+I expect it to do it right
+
+How often does this happen? 
+always
+
+
+Additional Information:
+Also tested under linux, the problem is the same.
+
+Sorry for my bad english.


More information about the mono-bugs mailing list