dotnet / dotnet/roslyn

Annoying IntelliSense behavior with multiply defined variables (18.3.0 Insiders [11109.51.main] but probably also 17.14)

Open
#80,730 0 comments 0 reactions 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

IntelliSense doesn't list ambiguous variables (e.g. variables that are multiply defined) leading to some unfortunate behavior if quickly type something followed by expecting the variable.

I am rewriting this function to add “double width” to the parameter list. Note this causes an error on line 90 – since I define a local variable of that name there – but there is no indication of an error on line 73.

Image

I then – on line 83 – type “if (wid” expecting to get the width parameter but instead – before the tab – I get this, so tab selects CaretWidthOption. Imagine how confusing this is if I’m working in a larger function.
My expectation is that things like IntelliSense would use the preceding definition of width rather than suppressing it entirely because there’s an error or ambiguity.

Image

Contributor guide

Open the contributing guide

Research direction

The issue names no source file, test, or entry point. Start by reproducing C# IntelliSense completion for a multiply defined local and parameter named width in the reported Roslyn/Visual Studio versions, then trace the completion path; done means the preceding definition remains available and Tab selects it instead of an unrelated suggestion.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.