[Mono-bugs] [Bug 71669][Nor] Changed - NullPointerException when setting a value-type field to null through reflection

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 30 Jan 2005 15:36:44 -0500 (EST)


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 miguel@ximian.com.

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

--- shadow/71669	2005-01-24 10:23:32.000000000 -0500
+++ shadow/71669.tmp.17048	2005-01-30 15:36:44.000000000 -0500
@@ -2,13 +2,13 @@
 Product: Mono: Class Libraries
 Version: 1.0
 OS: Debian Woody
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: serko84@hotmail.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -64,6 +64,43 @@
 
 How often does this happen? 
 When the field type is a value type.
 
 Additional Information:
 I'm using Mono 1.0.5 built from source on Debian testing.
+
+------- Additional Comments From miguel@ximian.com  2005-01-30 15:36 -------
+In the future, please provide fully contained samples.
+
+Here is a fully contained sample of the bug:
+
+using System.Reflection;
+using System;
+class OneDecimal
+	{
+		public decimal d;
+	};
+
+class T {
+	public void Test()
+	{
+		OneDecimal od = new OneDecimal();
+		od.d = 10.0m;
+
+		FieldInfo fi = typeof(OneDecimal).GetField("d",
+			BindingFlags.Instance | BindingFlags.Public);
+
+		fi.SetValue(od, null);
+
+		if (od.d != 0.0m)
+			throw new Exception ();
+	}
+
+static void Main ()
+{
+	
+
+T t = new T ();
+t.Test ();
+}
+}
+