dotnet/roslyn

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

Open

#50,777 opened on Jan 26, 2021

View on GitHub
 (1 comment) (0 reactions) (1 assignee)C# (4,257 forks)batch import
Area-IDEBugIDE-IntelliSenseIntelliSense-Completionhelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

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