[Mono-bugs] [Bug 78250][Min] New - Setting the "Text" property of
the "System.Windows.Forms.MenuItem" class to null causes an
exception.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Apr 30 21:27:44 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 georgegiolfan at yahoo.com.
http://bugzilla.ximian.com/show_bug.cgi?id=78250
--- shadow/78250 2006-04-30 21:27:44.000000000 -0400
+++ shadow/78250.tmp.7891 2006-04-30 21:27:44.000000000 -0400
@@ -0,0 +1,57 @@
+Bug#: 78250
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com
+ReportedBy: georgegiolfan at yahoo.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Setting the "Text" property of the "System.Windows.Forms.MenuItem" class to null causes an exception.
+
+Description of Problem:
+Setting the "Text" property of the "System.Windows.Forms.MenuItem" class to
+null causes an exception.
+
+Steps to reproduce the problem:
+Compile the following with "mcs Test.cs -r:System.Windows.Forms.dll":
+//Code starts here
+class MenuItemTextNullTest {
+ static void Main() {
+ (new System.Windows.Forms.MenuItem()).Text = null;
+ }
+}
+//Code ends here
+Run the resulting executable.
+
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00010> System.Windows.Forms.MenuItem:ProcessMnemonic ()
+in <0x00040> System.Windows.Forms.MenuItem:set_Text (System.String value)
+in (wrapper remoting-invoke-with-check) System.Windows.Forms.MenuItem:
+set_Text (string)
+in <0x00023> MenuItemTextNullTest:Main ()
+
+Expected Results:
+No output (no exceptions).
+
+How often does this happen?
+Allways.
+
+Additional Information:
+The "Text" property of the "MenuItem" class in the "System.Windows.Forms"
+namespace ("System.Windows.Forms.dll" assembly) sets the "text" field to
+the value it is assigned ant calls the "ProcessMnemonic" method which calls
+the "Lenght" property on the "text" Field. If the value that is assigned to
+the "Text" property is null, an exception is thrown.
+On Microsoft .NET Framework, this does not happen.
+A possible correction would be to check for null before calling any
+instance members of an object.
More information about the mono-bugs
mailing list