[Mono-bugs] [Bug 78806][Maj] New - Setting TextBox.SelectionStart causes NullReferenceException

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jul 10 12:20:10 EDT 2006


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 kuba.brecka at gmail.com.

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

--- shadow/78806	2006-07-10 12:20:10.000000000 -0400
+++ shadow/78806.tmp.19308	2006-07-10 12:20:10.000000000 -0400
@@ -0,0 +1,61 @@
+Bug#: 78806
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: kuba.brecka at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Setting TextBox.SelectionStart causes NullReferenceException
+
+Using mono 1.1.16, the following causes a NullReferenceException:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+  at System.Windows.Forms.Document.get_Caret () [0x00000] 
+  at System.Windows.Forms.TextBoxBase.CaretMoved (System.Object sender,
+System.EventArgs e) [0x00000] 
+  at System.Windows.Forms.TextBoxBase.ScrollToCaret () [0x00000] 
+  at System.Windows.Forms.TextBoxBase.set_SelectionStart (Int32 value)
+[0x00000] 
+  at (wrapper remoting-invoke-with-check)
+System.Windows.Forms.TextBoxBase:set_SelectionStart (int)
+  at MonoTest11.Form1..ctor () [0x00000] 
+  at (wrapper remoting-invoke-with-check) MonoTest11.Form1:.ctor ()
+  at MonoTest11.Form1.Main () [0x00000] 
+
+
+
+Reproduce code:
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace MonoTest11
+{
+    class Form1 : Form
+    {
+        static void Main()
+        {
+            Application.Run(new Form1());
+        }
+
+        public Form1()
+        {
+            TextBox T = new TextBox();
+            T.Text = "hello world";
+
+            Controls.Add(T);
+
+            T.SelectionStart = 6;
+            T.SelectionLength = 3;
+        }
+    }
+}


More information about the mono-bugs mailing list