[Mono-bugs] [Bug 75383][Nor] New - gmcs does not recognize IEnumerator<T> when a class implements IEnumerator<T>

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jun 26 05:33:16 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.


--- shadow/75383	2005-06-26 05:33:16.000000000 -0400
+++ shadow/75383.tmp.4265	2005-06-26 05:33:16.000000000 -0400
@@ -0,0 +1,84 @@
+Bug#: 75383
+Product: Mono: Compilers
+Version: 1.1
+OS Details: Mac OS X tiger
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dr.beyer at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: gmcs does not recognize IEnumerator<T> when a class implements IEnumerator<T>
+Please fill in this template when reporting a bug, unless you know what you are doing.
+Description of Problem:
+gmcs does not recognize IEnumerator<T> when a class implements IEnumerator<T>.  The 
+following example is taken from a Microsoft MSDN article at http://msdn.microsoft.com/
+gmcs appears to be looking for two GetEnumerator methods; one that returns IEnumerator and 
+another that returns IEnumerator<T>.  One class cannot define both of these, of course, and 
+gmcs should only be searching for IEnumerator<T>.
+Steps to reproduce the problem:
+1. gmcs t.cs
+//--------- t.cs -------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+namespace test
+  public class CityCollection : IEnumerable<string>
+  {
+    public IEnumerator<string> GetEnumerator()
+    {
+      yield return "New York";
+      yield return "Paris";
+      yield return "London";
+    }
+  }
+  class Program
+  {
+    public static void Main(string[] args)
+    {
+    }
+  }
+//--------- t.cs -------------
+Actual Results:
+gmcs t.cs
+t.cs(7) error CS0535: 'test.CityCollection' does not implement interface member 
+'System.Collections.IEnumerable.GetEnumerator' (name of symbol related to previous error
+Compilation failed: 1 error(s), 0 warnings
+Expected Results:
+Compliation should succeed.
+How often does this happen? 
+Additional Information:
+gmcs --version
+Mono C# compiler version
+mono --version
+Mono JIT compiler version, (C) 2002-2005 Novell, Inc and Contributors. www.mono-
+	TLS:           normal
+	GC:            Included Boehm (with typed GC)
+	SIGSEGV      : normal
+	Globalization: normal

More information about the mono-bugs mailing list