[Mono-bugs] [Bug 75382][Nor] New - gmcs causes ArgumentNullException in ModuleBuilder for IEnumerable<T>

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jun 26 04:01:38 EDT 2005


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 dr.beyer at gmail.com.

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

--- shadow/75382	2005-06-26 04:01:37.000000000 -0400
+++ shadow/75382.tmp.31414	2005-06-26 04:01:37.000000000 -0400
@@ -0,0 +1,124 @@
+Bug#: 75382
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: Mac OS X tiger
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dr.beyer at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs causes ArgumentNullException in ModuleBuilder for IEnumerable<T>
+
+Please fill in this template when reporting a bug, unless you know what you are doing.
+Description of Problem:
+
+gmcs causes ArgumentNullException in ModuleBuilder for IEnumerable<T> when two or more 
+variables are defined in the function.  The problem does not occur with only one variable defined.  
+The problem did not occur on mono version 1.1.7, but appeared in 1.1.8.1
+
+Steps to reproduce the problem:
+
+1. gmcs t.cs
+
+//---------- t.cs ----------
+using System;
+using System.Collections.Generic;
+
+namespace test
+{
+  class Test<T>
+  {
+    public IEnumerable<T> Lookup(T item)
+    {
+      byte i = 3;
+      byte j = 3;
+      yield return item;
+    }
+  }
+
+  class Program
+  {
+    public static void Main(string[] args)
+    {
+      Test<string> test = new Test<string>();
+      foreach(string s in test.Lookup("hi") )
+      {
+        Console.WriteLine(s);
+      }
+    }
+  }
+}
+//---------- t.cs ----------
+
+
+Actual Results:
+
+gmcs t.cs
+t.cs(11) warning CS0219: The variable 'j' is assigned but its value is never used
+t.cs(10) warning CS0219: The variable 'i' is assigned but its value is never used
+
+Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
+in <0x00000> <unknown method>
+in (wrapper managed-to-native) System.Reflection.Emit.ModuleBuilder:getToken 
+(System.Reflection.Emit.ModuleBuilder,object)
+in <0x0001c> System.Reflection.Emit.ModuleBuilder:GetToken (System.Reflection.MemberInfo 
+member)
+in <0x0002c> System.Reflection.Emit.ModuleBuilderTokenGenerator:GetToken 
+(System.Reflection.MemberInfo member)
+in <0x00050> System.Reflection.Emit.ILGenerator:Emit (OpCode opcode, 
+System.Reflection.FieldInfo field)
+in <0x00088> Mono.CSharp.Iterator+CapturedThisReference:Emit (Mono.CSharp.EmitContext 
+ec)
+in <0x002e4> Mono.CSharp.Argument:Emit (Mono.CSharp.EmitContext ec)
+in <0x00310> Mono.CSharp.Invocation:EmitArguments (Mono.CSharp.EmitContext ec, 
+System.Reflection.MethodBase mb, System.Collections.ArrayList arguments, Boolean dup_args, 
+Mono.CSharp.LocalTemporary this_arg)
+in <0x00164> Mono.CSharp.New:DoEmit (Mono.CSharp.EmitContext ec, Boolean 
+need_value_on_stack)
+in <0x0005c> Mono.CSharp.New:Emit (Mono.CSharp.EmitContext ec)
+in <0x00034> Mono.CSharp.EmptyCast:Emit (Mono.CSharp.EmitContext ec)
+in <0x00040> Mono.CSharp.Return:DoEmit (Mono.CSharp.EmitContext ec)
+in <0x00050> Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext ec)
+in <0x0012c> Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext ec)
+in <0x003a8> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext ec)
+in <0x00054> Mono.CSharp.EmitContext:EmitResolvedTopBlock (Mono.CSharp.ToplevelBlock 
+block, Boolean unreachable)
+in <0x000ac> Mono.CSharp.EmitContext:EmitTopBlock (Mono.CSharp.ToplevelBlock block, 
+Mono.CSharp.InternalParameters ip, Location loc)
+in <0x004ac> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer container, 
+Mono.CSharp.Attributable kind)
+in <0x00050> Mono.CSharp.Method:Emit ()
+in <0x007e4> Mono.CSharp.TypeContainer:EmitType ()
+in <0x0177c> Mono.CSharp.TypeContainer:EmitType ()
+in <0x00350> Mono.CSharp.RootContext:EmitCode ()
+in <0x00e50> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x00038> Mono.CSharp.Driver:Main (System.String[] args)
+
+Expected Results:
+Compilation to succeed without exception
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+mac-mini% gmcs --version
+gmcs --version
+Mono C# compiler version 1.1.5.0
+
+mac-mini% mono --version
+mono --version
+Mono JIT compiler version 1.1.8.1, (C) 2002-2005 Novell, Inc and Contributors. www.mono-
+project.com
+	TLS:           normal
+	GC:            Included Boehm (with typed GC)
+	SIGSEGV      : normal
+	Globalization: normal
+mac-mini%


More information about the mono-bugs mailing list