[Mono-bugs] [Bug 572053] New: foreach over a System.Collection.Generic.Dictionary<K, T> derived class throws CS0030 compilation error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jan 19 16:10:47 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=572053

http://bugzilla.novell.com/show_bug.cgi?id=572053#c0


           Summary: foreach over a
                    System.Collection.Generic.Dictionary<K,T> derived
                    class throws CS0030 compilation error
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: cummings.michael at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7)
Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7

/MonoGenericIteratorTest/Main.cs, Line=26, Column=25, Type=Error,
Priority=Normal, Description=Cannot convert type
`System.Collections.Generic.KeyValuePair<string,MonoGenericIteratorTest.MyType>'
to `MonoGenericIteratorTest.MyType'(CS0030)

Reproducible: Always

Steps to Reproduce:
1.Create a new Console Application in MonoDevelop
2.Paste the following code into the Main.cs file
<-------------------------------------------------------------------------------->
using System;
using System.Collections.Generic;

namespace MonoGenericIteratorTest
{
    public class MyType
    {

    }

    public abstract class MyCollectionBase<T> : Dictionary<string, T>
    {
    }

    public class MyCollection : MyCollectionBase<MyType>
    {

    }

    class MainClass
    {
        public static void Main(string[] args)
        {
            MyCollection myCollection = new MyCollection();

            foreach (MyType item in myCollection) {
                Console.WriteLine("Success.");
            }
        }
    }
}


Expected Results:  
This compiles without error under the .Net framework

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list