[Mono-bugs] [Bug 700184] New: A call to reimplemented interface method causes wrong method to be invoked.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jun 15 16:18:28 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=700184

https://bugzilla.novell.com/show_bug.cgi?id=700184#c0


           Summary: A call to reimplemented interface method causes wrong
                    method to be invoked.
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.10.x
          Platform: 64bit
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: very_anonymous at mailinator.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20110601
Firefox/4.0.1

I've used the following code sample from "The C# Programming Language. 4th
Edition" (it's slightly modified to make a complete program):

using System;

interface I<T>
{
    void F();
}

class Base<U>: I<U>
{
    void I<U>.F()
    {
        Console.WriteLine("F() in Base");
    }
}

class Derived<U,V>: Base<U>, I<V>
{
    void I<V>.F()
    {
        Console.WriteLine("F() in Derived");
    }
}

public class MainClass
{
    public static void Main()
    {
        I<int> x = new Derived<int,int>();
        x.F();
    }
}

It looks like there is a bug in Mono Runtime which causes the wrong method to
be executed in this case. According to the book, call to x.F() should invoke
the method from Derived, but instead the method from Base is executed.

Reproducible: Always

Steps to Reproduce:
1. Compile the aforementioned code
2. Run the resulting executable
3. Look at the output
Actual Results:  
Mono JIT compiler version 2.10.2 / Mono C# compiler version 2.10.2.0 :
    F() in Base

Mono JIT compiler version 2.10.2 / Microsoft (R) Visual C# 2010 Compiler
version 4.0.30319.1 :
    F() in Base

NET 4.0.30319 / Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1 :
    F() in Derived

NET 4.0.30319 / Mono C# compiler version 2.10.2.0 :
    F() in Derived

Expected Results:  
F() in Derived in all cases

-- 
Configure bugmail: https://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