dotnet/roslyn

Private extension methods are shown as null-unaware

Open

#80 648 ouverte le 10 oct. 2025

Voir sur GitHub
 (0 commentaires) (1 réaction) (0 assignés)C# (20 414 stars) (4 257 forks)batch import
Area-IDEhelp wanted

Description

Version Used: VS 18.0.0 Insiders [11109.219]

Steps to Reproduce: Show the quick info tooltip on each of the extension method invocations.

#nullable enable
static class Cx
{
    public static void M()
    {
        "".M1().M2().M3();
    }

    extension<T> (T s)
    {
        private T M1() => s;
        internal T M2() => s;
        public T M3() => s;
    }
}

Expected Behavior: As all extensions are declared in a nullable context, neither should show that is "not nullable aware".

Actual Behavior:

  • Hovering over M1() shows the signature and the notice "'M1' is not nullable aware."
  • Hovering over M2() and M3() shows the signature and no such notice.

Guide contributeur