[Mono-bugs] [Bug 77446][Maj] New - Nullable types assignment crashes reflection

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Feb 2 06:50:20 EST 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 vlm at lionet.info.

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

--- shadow/77446	2006-02-02 06:50:20.000000000 -0500
+++ shadow/77446.tmp.19539	2006-02-02 06:50:20.000000000 -0500
@@ -0,0 +1,80 @@
+Bug#: 77446
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: MacOS X 10.4
+Status: NEW   
+Resolution: 
+Severity: 008 One day
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: vlm at lionet.info               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Nullable types assignment crashes reflection
+
+Please fill in this template when reporting a bug, unless you know what you are doing.
+Description of Problem:
+
+When a nullable member of a class is assigned, reflection crashes in mono_object_unbox
+when trying to GetValue the object.
+
+Steps to reproduce the problem:
+1. Create a nullable string member of a class.
+2. Assign this member of a class to some "value".
+3. Use fieldInfo.GetValue() on that member. Experience assertion failure.
+
+Actual Results:
+
+[vlm at nala:~]> mono mono_object_unbox.exe 
+This statement can be reached
+
+** ERROR **: file object.c: line 2978 (mono_object_unbox): assertion failed: (obj->vtable->klass-
+>valuetype)
+aborting...
+Abort trap
+[vlm at nala:~]>
+
+Expected Results:
+
+[vlm at nala:~]> mono mono_object_unbox.exe 
+This statement can be reached
+THIS STATEMENT CANNOT BE REACHED
+[vlm at nala:~]>
+
+
+How often does this happen? 
+
+100% reproducible.
+
+Additional Information:
+
+=========================================================
+using System;
+using System.Reflection;
+
+public class UnboxingProblem {
+        public string? s;
+
+        public static void Main() {
+                UnboxingProblem problem = new UnboxingProblem();
+
+                FieldInfo[] fieldInfoList;
+                fieldInfoList = problem.GetType()
+                        .GetFields(BindingFlags.Public | BindingFlags.Instance);
+                FieldInfo fieldInfo = fieldInfoList[0];
+
+                object value = fieldInfo.GetValue(problem);
+                if(value != null) Console.WriteLine("EXPECTATION FAILED");
+                problem.s = "string";
+                Console.WriteLine("This statement can be reached");
+                value = fieldInfo.GetValue(problem);
+                Console.WriteLine("THIS STATEMENT CANNOT BE REACHED");
+                if(value == null) Console.WriteLine("EXPECTATION FAILED");
+        }
+
+}
+==========================================================


More information about the mono-bugs mailing list