dotnet/roslyn

nameof autocompletion on nested class doesn't work for parent class members

Aperta

#24.500 aperta il 28 gen 2018

 (7 commenti) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-CompilersBugLanguage-C#help wanted

Metriche repository

Star
 (20.414 stelle)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

Version Used: VS 15.5.5

Steps to Reproduce:

  1. Create a nested class, like this:
class A
{
    string PropertyA { get; }

    class B
    {
        void MethodB()
        {
            Console.WriteLine(nameof(PropertyA)));
        }
    }
}
  1. When typing nameof(P, PropertyA isn't shown as a suggestion, but the code compiles.

Expected Behavior: The code compiles and PropertyA is shown as suggestion.

Actual Behavior: The code compiles, but PropertyA isn't shown as suggestion.

Guida contributor