dotnet/roslyn

"Unused using" incorrectly reported in IDE

Open

#67,473 opened on Mar 23, 2023

View on GitHub
 (1 comment) (1 reaction) (0 assignees)C# (4,257 forks)batch import
Area-CompilersBugIDE-CodeStylehelp wanted

Repository metrics

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

Description

Using VS 17.6p3 and working on the compiler project at this commit: https://github.com/jcouv/roslyn/tree/unused-using-bug-67473

I open ExtensionTypeTests.cs and notice a greyed out using directive: image

But I remove this using, I get an error on line 5449 which uses VariableDeclaratorSyntax: image

I tried investigating whether the compiler is producing an incorrect HDN_UnusedUsingDirective hidden diagnostic, using a command-line build under debugger, but the hidden diagnostic was not produced. So I suspect there is some IDE issue, possibly with how the compilation is set up.

image

Contributor guide