Bug 18030

Summary: Mono C# compiler incorrectly emits CS0277 for derived classes that define a property whose signature matches a property that the base class has defined via explicit interface implementation
Product: [Mono] Compilers Reporter: emoriarty
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono, sig-rnd-sat-mono-bugs
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Tags: Is this bug a regression?: ---
Last known good build:

Description emoriarty 2014-02-26 14:11:56 UTC
Summary of the issue 
- Interface IX<T> has indexer property (this[int])
- A<T> implements IX<T> and implements IX<T>.this[int] via explicit interface
implementation
- B<T> derives from A<T> and define its own this[int] with internal setter

===== Test.cs =====
     1	interface IX<T>
     2	{
     3	    T this[int index] { get; set; }
     4	}
     5	
     6	class A<T> : IX<T>
     7	{
     8	    // Explicit implementation of interface property
     9	    T IX<T>.this[int index]
    10	    {
    11	        get { throw new System.NotImplementedException(); }
    12	        set { throw new System.NotImplementedException(); }
    13	    }
    14	}
    15	
    16	class B<T> : A<T>
    17	{
    18	    public T this[int index]
    19	    {
    20	        get { throw new System.NotImplementedException(); }
    21	        internal set { throw new System.NotImplementedException(); }
    22	    }
    23	}
===== End of Test.cs =====

===== csc output =====
# From Visual Studio 2013 command prompt
$ csc /target:library Test.cs
Microsoft (R) Visual C# Compiler version 12.0.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.


===== mcs output =====
$ mcs --version
Mono C# compiler version 3.2.6.0
Test.cs(21,18): error CS0277: Accessor `B<T>.this[int].set' must be declared public to implement interface member `IX<T>.this[int].set'
Test.cs(3,30): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

This failed in the same manner on the following versions of mcs that I tested with.
mono-2.11.4.0
mono-3.0.0.0
mono-3.1.1.0
mono-3.2.6.0


Edward Moriarty | Junior Engineer
Coverity | The Leader in Development Testing
Comment 1 Marek Safar 2014-05-07 09:10:46 UTC
Fixed in master