WIP - Use C# Dev Kit workspace dotnet for debugger checks - #9733
WIP - Use C# Dev Kit workspace dotnet for debugger checks#9733JakeRadMSFT wants to merge 3 commits into
Conversation
Feature-detect the optional C# Dev Kit workspace host export and defer only the debugger prerequisite decision. Preserve standalone discovery for absent, bypassed, old, or failed Dev Kit versions while suppressing competing remediation when Workspace Requirements is blocked.
|
/azp run |
|
Commenter does not have sufficient privileges for PR 9733 in repo dotnet/vscode-csharp |
There was a problem hiding this comment.
🔵 Needs a closer look
It changes debugger prerequisite discovery and activation-time behavior (including timeouts and environment shaping) across multiple entry points and warrants final human validation across platforms and Dev Kit states.
Pull request overview
This PR updates the C# extension’s debugger prerequisite discovery to optionally consume C# Dev Kit’s authoritative “Workspace Requirements” selected dotnet host (when available), ensuring the debugger uses the exact executable/environment selected for the workspace and avoiding duplicate/competing SDK remediation messaging.
Changes:
- Extend
CSharpDevKitExportswith an optionalgetWorkspaceDotnetHost()contract and add a resolver with bounded waiting/fallback behavior. - Plumb the resolved workspace
dotnethost through CoreCLR debugger activation/install checks and debug adapter launch configuration (includingDOTNET_ROOT). - Add unit coverage for workspace-host resolution behavior and for passing a selected
dotnet+ environment intodotnet --info/--list-runtimes.
File summaries
| File | Description |
|---|---|
| test/omnisharp/omnisharpUnitTests/coreclrDebug/workspaceDotnetHost.test.ts | Adds unit tests validating bounded Dev Kit export resolution and fallback/blocked behaviors. |
| test/omnisharp/omnisharpUnitTests/coreclrDebug/getDotnetInfo.test.ts | Adds unit test validating exact executable/env propagation for dotnet --info / --list-runtimes. |
| src/shared/utils/getDotnetInfo.ts | Adds optional overrides for dotnet executable path and environment, and applies them consistently across probes. |
| src/main.ts | Threads the Dev Kit exports promise through to the CoreCLR debugger activation path. |
| src/csharpDevKitExports.ts | Defines WorkspaceDotnetHost and adds optional getWorkspaceDotnetHost() export. |
| src/coreclrDebug/workspaceDotnetHost.ts | New resolver that waits (bounded) for Dev Kit activation/host selection and maps it to C#’s needs. |
| src/coreclrDebug/util.ts | Extends .NET CLI check to accept an explicit dotnet executable and environment. |
| src/coreclrDebug/activate.ts | Uses resolved workspace host for debugger install prerequisites and debug adapter execution environment decisions. |
| src/activateRoslyn.ts | Returns Dev Kit exports as a promise so downstream components can defer specific work without awaiting activation. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Converge debugger prerequisite checks on the optional workspace dotnet service contract while preserving standalone compatibility. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Guard the activation continuation after the timeout to prevent late competing Dev Kit UI.
Review details
Suppressed comments (1)
src/coreclrDebug/activate.ts:244
- The timeout only resolves the outer race; it does not stop this activation chain. If
activate()is still pending when the 90-second timer wins, a later activation completion will still invokegetWorkspaceDotnetHost()after this function has already fallen back to standalone probing. Since the blocked result is the state associated with opening Workspace Requirements, this can produce the competing Dev Kit UI after the C# SDK notification; guard the continuation after timeout or use a cancellable producer contract.
return await Promise.race([
Promise.resolve()
.then(async () => await csharpDevKit.activate())
.then(async (exports) => await exports?.dotnet?.getWorkspaceDotnetHost?.())
.catch(() => undefined),
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
Prevent a Dev Kit activation that finishes after the bounded fallback from starting workspace host resolution and competing remediation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Summary
Fixes #9732 by making debugger prerequisite discovery consume C# Dev Kit's authoritative workspace
dotnethost when the installed Dev Kit supports the additive public contract.exports.dotnet?.getWorkspaceDotnetHostwithout requiring a newer C# Dev Kit.dotnetPathand environment returned for debuggerdotnet --infoanddotnet --list-runtimeschecks.blocked.dotnet.preferCSharpExtension, older, not applicable, fails activation, rejects the optional call, or does not settle within the bounded wait.Compatibility
dotnet.preferCSharpExtensiondotnet, or version0.1service without the optional methodnot-applicableblockedreadyProducer
The corresponding additive producer is vs-green !780185, currently at
77c0b74d56ed7d789185cc810297345ebcd6fc27against64b7aa338a07008a6e10788c8207afa5993f3ed1. Its publicWorkspaceDotnetServiceremains version0.1, keepsgetSdkInfo()andonDidChangeSdkInfo, and optionally addsgetWorkspaceDotnetHost()returningready,blocked, ornot-applicable.Validation
--noEmit: passed25d0d68771412ec4c65255011cdb8681a5228022had an unrelated LinuxZipInstallertemp-cleanupENOTEMPTYfailure; this PR does not change package installation or temporary-directory cleanupCurrent gate
The converged head has been pushed. GitHub checks and current-head review for this new head must pass before the PR is marked ready for review.