Skip to content

chore: remove unnecessary using to fix the Lint check - #11085

Open
lahma wants to merge 1 commit into
dotnet:mainfrom
lahma:lint-unnecessary-using
Open

chore: remove unnecessary using to fix the Lint check#11085
lahma wants to merge 1 commit into
dotnet:mainfrom
lahma:lint-unnecessary-using

Conversation

@lahma

@lahma lahma commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

The Lint check (dotnet format --no-restore --verify-no-changes) is currently failing on main and therefore on every open pull request. This removes the one directive it flags.

test/Docfx.Dotnet.Tests/SymbolUrlResolverUnitTest.cs(5,1): warning IDE0005: Using directive is unnecessary.

Why the directive is genuinely unnecessary

No name written in that file resolves through Microsoft.CodeAnalysis. The symbol types only ever appear bound to varCompilationHelper.CreateCompilationFromAssembly is deconstructed into var (compilation, assembly), and everything afterwards (assembly.GetTypeByMetadataName, type.GetMembers) is an instance member call, which needs no using. The file compiles unchanged without it.

Evidence that this is pre-existing rather than PR-specific

Verification

  • dotnet format --no-restore --verify-no-changes — the exact CI command — now exits 0 across the whole solution.
  • Docfx.Dotnet.Tests, Release, net10.0: 172/172 passing, 0 build warnings.

A durable fix worth considering separately

The repository pins no global.json, so the analyzer set is whatever SDK the runner image happens to ship. IDE0005's analysis got stricter in a newer Roslyn and the check went red without anything in the repository changing — which is a failure mode that will recur on the next image bump. Pinning an SDK version in global.json (with rollForward set to taste) would make the lint result reproducible rather than dependent on runner timing. I have left that out of this PR, since removing the directive is what unblocks CI today and the pin is a separate decision for you to make.

`dotnet format --no-restore --verify-no-changes` currently fails on main with

  test/Docfx.Dotnet.Tests/SymbolUrlResolverUnitTest.cs(5,1):
  warning IDE0005: Using directive is unnecessary.

No name in that file resolves through Microsoft.CodeAnalysis - the symbol types
are only ever bound to `var` - so removing the directive leaves the file
compiling unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016uV6H9cTntzsoKiaJRBn4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant