dotnet/roslyn

IDE0130 Warning uses Symbol name instead of directory path for new files

Open

#78.837 geöffnet am 5. Juni 2025

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-IDEhelp wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

Version Used: Microsoft.CodeAnalysis.LanguageServer.win-x64 5.0.0-1.25305.1

Steps to Reproduce:

  1. Create a default project, seems to apply for anything so, dotnet new console
  2. Make a directory in it
  3. Make a new class in it with a namespace
  4. Observe asap Roslyn raises IDE0130, suggesting the namespace should just be "{File's Name}" instead
  5. Close editor and shut down LSP
  6. Re-open, observe the issue has now gone away, seems to only occur on newly made files

See the example pic below:

Diagnostic Id: IDE0130

Expected Behavior: IDE0130 Should use the Directory the file exists diff'd with the "root" directory, to determine the expected namespace to suggest

Actual Behavior: It's instead just suggesting a namespace of the File's name, and that's it, see the example pic below

Image

This could theoretically be the plugin handing an invalid path to Roslyn, but as far as I know this sort of stuff just gets detected by Roslyn on its own? Lemme know if this is instead a bug I should raise over on the plugin side instead, or if there's an easy way I can debug which side the issue is on.

Contributor Guide