[Mono-bugs] [Bug 501052] New: Generic inheritance not recognised

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 5 11:48:38 EDT 2009


           Summary: Generic inheritance not recognised
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: lytico at users.sourceforge.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:
Gecko/2008070208 Firefox/3.0.1

Trying to compile the following code fails with:

error CS0309: The type
must be convertible to
in order to use it as parameter `TDictionary' in the generic type or method

Reproducible: Always

Steps to Reproduce:

using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace Limada.MonoTests.Generics {
    public class MultiDictionary<K, V, TDictionary>
        where TDictionary : IDictionary<K, ICollection<V>>
    { }

    public class Test {
        public  void Main() {
            // this fails:
            var c = new MultiDictionary<int, int, Dictionary<int,


in ms-net, the code compiles fine.
in mono, ms-net-compiled code RUNS fine.

// this works:
            IDictionary<int, ICollection<int>> d =
                new Dictionary<int, ICollection<int>> ();

            Type expr_type = typeof(Dictionary<int, ICollection<int>>);
            Type target_type = typeof(IDictionary<int, ICollection<int>>);

                target_type.IsInterface.ToString() + 
                target_type.IsAssignableFrom (expr_type).ToString());

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