[Mono-bugs] [Bug 501775] New: Wrong warning CS0109 with protected field that hides field from base class

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 7 09:55:59 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=501775

User eb1 at sil.org added comment
http://bugzilla.novell.com/show_bug.cgi?id=501775#c463613

           Summary: Wrong warning CS0109 with protected field that hides
                    field from base class
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: eb1 at sil.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


I have a base class in a library that defines a protected field:

    protected int Foo = 0;

In a derived class I hide the field from the base class:

    protected new int Foo = 99;

On .NET this compiles without warnings.

On Mono I get a warning: warning CS0109: The member `Derived.Foo' does not hide
an inherited member. The new keyword is not required

If I ommit the 'new' on .NET I get warning CS0108. On Mono this compiles
without a warning.

If both classes are in the same assembly it works as expected.

It seems clearly wrong that we get different results depending on whether the
base class is in the same assembly or not. This problems is related to #463613.

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