dotnet/roslyn

Private extension methods are shown as null-unaware

Open

#80.648 geöffnet am 10. Okt. 2025

Auf GitHub ansehen
 (0 Kommentare) (1 Reaktion) (0 zugewiesene Personen)C# (20.414 Stars) (4.257 Forks)batch import
Area-IDEhelp wanted

Beschreibung

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.

Contributor Guide