[Mono-bugs] [Bug 44294][Wis] New - Mono gives null ref exception accessing fields in csc-compiled programs

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sat, 7 Jun 2003 18:25:14 -0400 (EDT)


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 mathpup@mylinuxisp.com.

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

--- shadow/44294	Sat Jun  7 18:25:14 2003
+++ shadow/44294.tmp.6043	Sat Jun  7 18:25:14 2003
@@ -0,0 +1,72 @@
+Bug#: 44294
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono gives null ref exception accessing fields in csc-compiled programs
+
+Description of Problem: 
+ 
+This problem only occurs when using mono with programs compiled with csc. When 
+accessing a static property, Mono gives a null reference exception. See the test case 
+below, which is taken from Qt#: 
+ 
+using System; 
+ 
+ 
+internal struct QNull 
+{ 
+        private static QNull instance; 
+ 
+        internal static QNull Instance 
+        { 
+            get { return instance; } 
+        } 
+} 
+ 
+   
+public class Testing 
+{ 
+    public static void Main() 
+    { 
+        object o = QNull.Instance; 
+    } 
+} 
+ 
+Steps to reproduce the problem: 
+1. csc program.cs 
+2. mono program.exe 
+ 
+ 
+Actual Results: 
+ 
+Unhandled Exception: System.NullReferenceException: A null value was found where 
+an object instance was required 
+ 
+ 
+Expected Results: 
+ 
+(no output) 
+ 
+ 
+How often does this happen?  
+ 
+Always 
+ 
+ 
+Additional Information: 
+ 
+The combination of csc and mono is the problem. Changing the C# compiler or the 
+runtime engine (e.g. Rotor) works fine. The metadata produced by mcs differs 
+considerably from that of csc. I'm attaching disassembled versions of the two.