[Mono-bugs] [Bug 82080][Min] New - gmcs throws exception when "yield" used in constructor

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 11 22:51:00 EDT 2007


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 chuck.esterbrook at gmail.com.

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

--- shadow/82080	2007-07-11 22:51:00.000000000 -0400
+++ shadow/82080.tmp.11117	2007-07-11 22:51:00.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 82080
+Product: Mono: Compilers
+Version: 1.2
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: Chuck.Esterbrook at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs throws exception when "yield" used in constructor
+
+Description of Problem:
+
+gmcs (1.2.4.0) throws an unhandled exception instead of reporting an error
+when "yield return" or "yield break" are used in a constructor.
+
+Steps to reproduce the problem:
+1. cat > y.cs
+class Program {
+        public Program() {
+                yield break;
+        }
+        static public void Main() {
+        }
+}
+2. gmcs y.cs
+
+Actual Results:
+
+Unhandled Exception: Mono.CSharp.InternalErrorException: y.cs(2,16):
+Program.Program() ---> System.NullReferenceException: Object reference not
+set to an instance of an object
+  at Mono.CSharp.Yield.CheckContext (Mono.CSharp.EmitContext ec, Location
+loc, Boolean isYieldBreak) [0x00000] 
+  at Mono.CSharp.YieldBreak.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
+  at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext
+anonymous_method_host, Mono.CSharp.ToplevelBlock block,
+Mono.CSharp.Parameters ip, IMethodData md, System.Boolean& unreachable)
+[0x00000] 
+  at Mono.CSharp.Constructor.Emit () [0x00000] 
+  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] --- End of
+inner exception stack trace ---
+
+  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] 
+  at Mono.CSharp.TypeContainer.EmitType () [0x00000] 
+  at Mono.CSharp.RootContext.EmitCode () [0x00000] 
+  at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000] 
+  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] 
+
+Expected Results:
+
+A normal error message from the compiler.
+
+How often does this happen? 
+
+Always.
+
+Additional Information:
+
+None.


More information about the mono-bugs mailing list