[Mono-bugs] [Bug 66014][Nor] New - NullReferenceException when iterating over generic Collection

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 15 Sep 2004 13:05:05 -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 gert.driesen@pandora.be.

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

--- shadow/66014	2004-09-15 13:05:05.000000000 -0400
+++ shadow/66014.tmp.18324	2004-09-15 13:05:05.000000000 -0400
@@ -0,0 +1,43 @@
+Bug#: 66014
+Product: Mono: Runtime
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Gentoo 2.6.8 R2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException when iterating over generic Collection
+
+When iterating over a generic Collection a NullReferenceException is 
+reported.
+
+Compile the following code (using gmcs, eg. gmcs test.cs) :
+
+using System;
+using System.Collections.Generic;
+
+public class EntryPoint {
+	public static void Main(string[] args) {
+		Collection<int> list = new Collection<int>();
+		foreach (int i in list) {
+			Console.WriteLine(i);
+		}		
+	}
+}
+
+When you execute the resulting assembly (eg. mono test.exe) you'll get 
+the following exception :
+
+Unhandled Exception: System.NullReferenceException: Object reference not 
+set to an instance of an object
+in <0x0004f> EntryPoint:Main (string[])
+
+PS. I'm using mono built from cvs head.