dotnet/roslyn

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

Aperta

#50.777 aperta il 26 gen 2021

 (1 commento) (0 reazioni) (1 assegnatario)C# (4257 fork)batch import
Area-IDEBugIDE-IntelliSenseIntelliSense-Completionhelp wanted

Metriche repository

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

Descrizione

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.

Guida contributor