bkoelman / ResharperCodeContractNullability

Reports diagnostics, helping you to annotate your source tree with (Item)NotNull / (Item)CanBeNull attributes.
https://www.jetbrains.com/resharper/help/Code_Analysis__Code_Annotations.html
Apache License 2.0
26 stars 4 forks source link

Unexpected diagnostic on an overriding member, whose base member implements an annotated interface member #3

Closed bkoelman closed 9 years ago

bkoelman commented 9 years ago

A diagnostic is reported on N.C.M in the next code snippet:

namespace N
{
    public interface I
    {
        [NotNull]
        string M();
    }

    public class B : I
    {
        public virtual string M() { throw new NotImplementedException(); }
    }

    public class C : B
    {
        public override string M() { throw new NotImplementedException(); }
    }
}

But when applying a nullability attribute on it, Resharper then grays it out as unneeded, because the annotation from N.I.M applies.