dotnet/roslyn

Completion shows other properties in generic method inside object initializers, not types

Offen

#50.777 geöffnet am 26.01.2021

 (1 Kommentar) (0 Reaktionen) (1 zugewiesene Person)C# (4.257 Forks)batch import
Area-IDEBugIDE-IntelliSenseIntelliSense-Completionhelp wanted

Repository-Metriken

Stars
 (20.414 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

A bit complicated, but a repro speaks many, many words:

namespace Test
{
    public class Class1
    {
        public string Prop { get; set; }
        public string Prop2 { get; set; }

        public string M<T1, T2>()
        {
            _ = new Class1
            {
                Prop = M<string, $$
            }
        }
    }
}

Invoking completion at the $$ shows Prop2, not types. If I add another >, or fill in a value for Prop2 above/below, I correctly get type completion there.

Contributor Guide