[Mono-bugs] [Bug 72678][Nor] New - NullReferenceException compiling code with nested types
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 17 Feb 2005 06:23:26 -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 ximian-bugzilla@winsper.org.uk.
http://bugzilla.ximian.com/show_bug.cgi?id=72678
--- shadow/72678 2005-02-17 06:23:26.000000000 -0500
+++ shadow/72678.tmp.27090 2005-02-17 06:23:26.000000000 -0500
@@ -0,0 +1,43 @@
+Bug#: 72678
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details: Debian sid AMD64
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ximian-bugzilla@winsper.org.uk
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: NullReferenceException compiling code with nested types
+
+I was trying to use C# like Java yesterday when I came across this crasher.
+ The code isn't actually semantically valid C# (as far as I can tell), but
+the compiler should throw an error rather than crash.
+
+I was trying to create a nested type (Auth.AuthQuery) that used a property
+of its containing class (Auth) in the constructor (base(Account)). In this
+case, Account is both a type and a property that returns a reference to an
+Account object. This seems to confuse mcs, so it throws a
+NullReferenceException.
+
+Steps to reproduce the problem:
+1. Compile attached file with mcs /out:test.dll /target:library Auth.cs
+2. marvel at the lovely stack trace
+
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x0002e> Mono.CSharp.PropertyExpr:EmitInstance (Mono.CSharp.EmitContext)
+in <0x00042> Mono.CSharp.PropertyExpr:Emit (Mono.CSharp.EmitContext,bool)
+
+Expected Results:
+Some sort of C# error.
+
+How often does this happen?
+Every time.