Regression: automatic solution discovery misses .sln/.slnx files after #9286
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp, typescript, vscode
- 領域
- devtools
調査の方向性
src/lsptoolshost/server/roslynLanguageServer.ts の openDefaultSolutionOrProjects() と、565 行目付近の solutionUris の検出から始めます。単一ソリューションの場合と fallback の場合を再現し、その後 .sln、.slnx、複数ソリューションに対する回帰テストを追加します。両方の拡張子が検出され、選択したソリューションの外部にあるプロジェクトが読み込まれなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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.csharp2.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
.slnfile undersrc/, containing 12 projects; one additional.csprojexists 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
- Use the C# extension in standalone mode, with C# Dev Kit absent or disabled and
dotnet.defaultSolutionunset. - Open a folder containing exactly one solution, for example
src/App.sln. - Have at least one
.csprojunder that folder which is deliberately not included inApp.sln. Keep files from that excluded project closed. - Activate the C# extension by opening a C# file from an included project.
- Inspect the C# output: the extension uses
project/opento 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
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/vscode-csharp のほかの issue
-
Infrastructure Test
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
dotnet/vscode-csharp#9791 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
untriaged
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
dotnet/vscode-csharp#9816 ·
メンテナーはふだん 1 日以内に返信
-
untriaged
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
dotnet/vscode-csharp#9814 ·
メンテナーはふだん 1 日以内に返信
-
C# crashオープンC#DK untriaged
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
dotnet/vscode-csharp#9807 ·
メンテナーはふだん 1 日以内に返信
-
Editor-Formatting Resolved-Configuration Issue
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
dotnet/vscode-csharp#9804 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
dotnet/vscode-csharp の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
StabilityNexus/Fate-EVM-Frontend#153 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
code-yeongyu/oh-my-openagent#9039 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Tencent/teamai-cli#862 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue hacktoberfest redis
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
libredb/libredb-studio#1164 ·
メンテナーはふだん 1 日以内に返信
-
flake
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信