[Mono-bugs] [Bug 444388] CS0229/CS0122 Ambiguity on interface member hiding

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 19 16:54:08 EST 2009


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

User jonbnews at hotmail.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=444388#c1


Jon Burgoyne <jonbnews at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonbnews at hotmail.com




--- Comment #1 from Jon Burgoyne <jonbnews at hotmail.com>  2009-01-19 14:54:07 MST ---
This appears to be related to
https://bugzilla.novell.com/show_bug.cgi?id=323096, although that one seems to
be fixed (still fixed correctly in 2.2).  The issue looks to be the same, but
without as much inheritance as this issue.

I would think this would be a much bigger problem than it apparently is.  It
seems than any interface that does multiple inheritance of other interfaces and
hides a method/property from one of those inherited interfaces is problematic. 
I've run into this problem doing "read-only-style" interfaces like this:

IReadOnlyObject
{
   Guid Id { get; }
   string DoSomething();   
}

IPersistableObject
{
   Guid Id { get; set; }
}

IMyObject : IPersistableObject, IReadOnlyObject
{
   // Must declare a "new" Id which hides the ones from the
   // inherited interfaces so that we don't get legitimate
   // ambiguous reference errors.
   new Guid Id { get; set; }
}

Now if you try to do:

IMyObject myObj = ... as IMyObject;
myObj.Id;

The second line results in the compilation error described in this issue.

(The above code is not a test case and it may not even compile - it's just
trying to give the "gist" of the problem in the context in which I encountered
it).

Seeing as this appears to be related to another issue that was fixed, perhaps
looking at the fix for one that will shed light on this issue.

-- 
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