Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Regression: automatic solution discovery misses .sln/.slnx files after #9286

オープン 初心者向け
#9,808 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp, typescript, vscode
領域
devtools

調査の方向性

src/lsptoolshost/server/roslynLanguageServer.ts の openDefaultSolutionOrProjects() と、565 行目付近の solutionUris の検出から始めます。単一ソリューションの場合と fallback の場合を再現し、その後 .sln、.slnx、複数ソリューションに対する回帰テストを追加します。両方の拡張子が検出され、選択したソリューションの外部にあるプロジェクトが読み込まれなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

untriaged

Issue description

Automatic solution discovery in the standalone C# extension misses a workspace's single .sln file. The extension then falls back to loading every .csproj, including projects deliberately excluded from the solution. In my workspace, this causes a project-loading error and a "There were problems loading project" notification for an excluded project.

The regression was introduced by PR #9286: .slnx support, merged on May 22, 2026. The exact change is in roslynLanguageServer.ts, line 565 of merge commit d8833483c84164fe0bfb25695bb1ed8bdd395463:

- const solutionUris = await vscode.workspace.findFiles('**/*.sln', '**/node_modules/**', 2);
+ const solutionUris = await vscode.workspace.findFiles('**/*.slnx?', '**/node_modules/**', 2);

In VS Code glob syntax, ? matches one character; it does not make the preceding x optional. Therefore **/*.slnx? matches neither .sln nor .slnx.

Environment data

  • OS: Arch Linux, x86_64
  • VS Code: 1.139.0
  • C# extension: ms-dotnettools.csharp 2.160.4
  • Mode: standalone C# extension; C# Dev Kit is not installed
  • Installed .NET SDKs: 9.0.318 and 10.0.401
  • dotnet.defaultSolution: unset
  • Workspace: one .sln file under src/, containing 12 projects; one additional .csproj exists outside the solution's project list

C# logs

Relevant excerpts from the affected workspace, with project names and paths anonymized:

2026-09-24 13:09:54.782 [info] Activating C# standalone...
2026-09-24 13:09:57.655 [error] [project/open] [LanguageServerProjectSystem] Error while loading <workspace>/src/ExcludedApp/ExcludedApp.csproj: Project '../Core/Core.csproj' targets 'net10.0'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v6.0'.
2026-09-24 13:09:58.460 [info] [project/open] [LanguageServerProjectSystem] Completed (re)load of 13 project(s) in 00:00:02.8283748

The framework mismatch belongs to a project that is not in the solution. The regression is that automatic discovery loads it anyway.

Steps to reproduce

  1. Use the C# extension in standalone mode, with C# Dev Kit absent or disabled and dotnet.defaultSolution unset.
  2. Open a folder containing exactly one solution, for example src/App.sln.
  3. Have at least one .csproj under that folder which is deliberately not included in App.sln. Keep files from that excluded project closed.
  4. Activate the C# extension by opening a C# file from an included project.
  5. Inspect the C# output: the extension uses project/open to load all discovered projects, including the excluded project, instead of opening the solution. If the excluded project has an incompatible project reference, a project-loading error notification is shown.

Expected behavior

The single solution is discovered and opened automatically. Only its projects and their required references are loaded. Discovery should recognize both .sln and .slnx files.

Actual behavior

The glob finds no solutions. openDefaultSolutionOrProjects() takes its zero-solutions branch and enumerates **/*.csproj, ignoring the intended solution membership.

I verified the installed 2.160.4 extension contains this pattern and that the workspace has only one solution. The same pattern is also present in the upstream source inspected during diagnosis.

Suggested fix

Use a glob that explicitly matches the two extensions:

const solutionUris = await vscode.workspace.findFiles('**/*.{sln,slnx}', '**/node_modules/**', 2);

Regression coverage should check automatic discovery with one .sln, one .slnx, and multiple solutions, and ensure projects outside the selected solution are not loaded by the fallback path.

Workaround

Setting an explicit solution path should bypass the broken discovery branch:

{
  "dotnet.defaultSolution": "src/App.sln"
}

The workaround follows from the loading code; it has not yet been applied or verified in the affected VS Code session.

主要言語
TypeScript
スター
3.1k
フォーク
736
平均マージ
21時間 46分
マージ済み PR(30日)
38

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/vscode-csharp のほかの issue

dotnet/vscode-csharp の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。