[Mono-bugs] [Bug 333891] New: CS0122 error when accessing member hidden by non-accessible member

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 15 09:19:02 EDT 2007


           Summary: CS0122 error when accessing member hidden by non-
                    accessible member
           Product: Mono: Compilers
           Version: 1.2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: rharinath at novell.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at ximian.com
          Found By: ---

When a member of base class is "hidden" by a non-accessible member, then (g)mcs
reports CS0122 when the public member is referenced while it should ignore the
hiding member since it is not publicly accessible.

To reproduce, compile the following code:

using System;

class Program
        static int Main ()
                B b = new B ();
                if (b.Message != "OK")
                        return 1;
                return 0;

class A
        public virtual string Message {
                get {
                        return "OK";

class B : A
        new string Message {
                get {
                        throw new Exception ();

Expected result:

Successful compilation.

Actual result:

test.cs(8,21): error CS0122: `B.Message' is inaccessible due to its protection

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

More information about the mono-bugs mailing list