Use C# Dev Kit workspace dotnet for debugger checks - #9733
Open
JakeRadMSFT wants to merge 1 commit into
Open
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.
Member
Author
|
/azp run |
|
Commenter does not have sufficient privileges for PR 9733 in repo dotnet/vscode-csharp |
Contributor
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #9732 by making debugger prerequisite discovery consume C# Dev Kit's authoritative Workspace Requirements host when the installed Dev Kit supports the new optional contract.
CSharpDevKitExportsshape with optionalgetWorkspaceDotnetHost().dotnet --info,dotnet --list-runtimes, architecture selection, and debuggerDOTNET_ROOT.blocked.Compatibility matrix
dotnet.preferCSharpExtensiongetWorkspaceDotnetHost()blockedreadynot-applicableActivation safety
C# continues to call
Extension.activate()without synchronously awaiting it from the C# activation path. The resulting promise is passed only to debugger prerequisite completion. This allows C# activation to return, lets Dev Kit finish its existing C#→Dev Kit activation cycle, handles rejection/timeouts, and memoizes the decision per activation.Validation
tsc --noEmit)dotnetonPATH: Workspace Requirements opened in blocked state and the notification center did not containThe .NET SDK cannot be locatedFollow-up producer change
The corresponding optional C# Dev Kit export is implemented in https://devdiv.visualstudio.com/DevDiv/_git/vs-green/pullrequest/778204 so this C# change remains safe to ship first. Until that producer version is installed, feature detection follows the old-export fallback row above.