Use C# Dev Kit selected workspace dotnet host for debugger prerequisite checks

未关闭
#9,732 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@JakeRadMSFT 已经在做这个了。

开始于 2026年9月4日。

  • #9733 来自 @JakeRadMSFT —— 未关闭
  • #9820 来自 @emaf —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp, typescript, vscode

调研方向

从 src/coreclrDebug/util.ts 和 checkDotNetCli() 开始,然后跟踪 src/coreclrDebug/activate.ts 和 showDotnetToolsWarning(),以及 C# Dev Kit 的发现和导出文件。重现 Remote SSH 激活场景,并验证 C# 使用选定的工作区主机,在被阻止期间抑制重复的 remediation,并在 Dev Kit 缺失或被绕过时保留独立运行行为。

由索引模型根据 Issue 内容生成。

描述

Debugger untriaged
Problem

When C# Dev Kit owns workspace SDK selection through Workspace Requirements, the C# extension still independently runs dotnet --info against its own configured paths/ambient PATH during debugger activation.

In a Remote SSH Linux workspace with no ambient dotnet on PATH, this produces two competing remediations at once:

  • C# Dev Kit opens Workspace Requirements with Install .NET 10 SDK.
  • The C# extension shows The .NET SDK cannot be located with Get the SDK.

The C# notification is especially confusing because its Get the SDK action already delegates to csdevkit.installDotnetSdk when C# Dev Kit is present, while the prerequisite check that raised it did not use C# Dev Kit's selected host or blocked state.

Observed with:

  • C# Dev Kit 9.9.554-g91f1bb
  • C# 2.140.9
  • VS Code Remote SSH to Ubuntu 24.04 x64
  • no ambient dotnet on the remote PATH

Relevant current code:

  • src/coreclrDebug/util.ts: checkDotNetCli() runs dotnet --info using C# extension paths.
  • src/coreclrDebug/activate.ts: showDotnetToolsWarning() routes Get the SDK to csdevkit.installDotnetSdk when Dev Kit is present.
  • src/utils/getCSharpDevKit.ts and src/csharpDevKitExports.ts: C# already discovers and consumes C# Dev Kit exports, but there is no selected workspace host/readiness contract.
Expected behavior

C# Dev Kit should be the single SDK/host authority when it is active and dotnet.preferCSharpExtension is not selected:

  1. C# obtains the exact workspace dotnet executable and environment selected by C# Dev Kit before debugger prerequisite checks.
  2. If Workspace Requirements is blocked and has opened its remediation UI, C# does not show a second SDK-install notification.
  3. After the user installs or selects the SDK and reloads, both extensions use the same host.
  4. When C# Dev Kit is absent or explicitly bypassed, C# retains its current standalone discovery and notification behavior.

A minimal contract could be an optional C# Dev Kit export returning { status: ready | blocked, dotnetPath?, environment? }. Because workspace host changes are already reload-bound, this does not require live language-server/debugger host switching.

Related
  • microsoft/vscode-dotnettools#1243
  • microsoft/vscode-dotnettools#792
  • dotnet/vscode-csharp#6620
主要语言
TypeScript
星标
3.1k
派生
741
平均合并
1 天 8 小时
30 天内合并 PR
59

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dotnet/vscode-csharp 的其他 Issue

查看 dotnet/vscode-csharp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。