Repository navigation
Description
Describe the issue
On a fresh macOS machine where the only .NET is the official .pkg install at /usr/local/share/dotnet (SDK 10.0.301, below the 10.0.400 minimum) and dotnetup is not installed, C# Doctor offers Correct .NET environment as the fix. Clicking it:
- finishes in ~150 ms without installing anything,
- writes a block to
~/.zshrcthat pins new shells to the same below-minimum root:# >>> C# Dev Kit .NET environment >>> export DOTNET_ROOT='/usr/local/share/dotnet' case "${PATH-}" in '/usr/local/share/dotnet'|'/usr/local/share/dotnet':*) ;; *) export PATH='/usr/local/share/dotnet'"${PATH:+:$PATH}" ;; esac # <<< C# Dev Kit .NET environment <<<
- tells the user to relaunch VS Code.
After the relaunch nothing has changed: the same 10.0.301 SDK is selected and Doctor now offers Install .NET 10 SDK. That install (via dotnetup) works and dotnetup adds its own .zshrc block after ours, so new shells end up on the dotnetup root, but the stale C# Dev Kit block that points at /usr/local/share/dotnet is left behind in ~/.zshrc.
So the first action offered is a no-op that edits the user's shell profile and costs a relaunch, and it leaves a contradictory profile entry.
Collect logs
No .NET: Collect C# Dev Kit Logs zip attached yet (available on request). Relevant C# Dev Kit.log lines:
[warning] The Visual Studio Code process environment candidate "/usr/local/share/dotnet/dotnet" selected SDK 10.0.301, which is older than the minimum supported SDK 10.0.400. ...
[info] Starting: Correct .NET environment
[info] Starting: Discover existing dotnetup environment repair targets
[info] Completed: Discover existing dotnetup environment repair targets (1ms)
[info] Completed: Correct .NET environment (148ms)
... (relaunch) ...
[info] Workspace tooling auto-resolution is installing stable SDK 10.0.400 using managed-user-profile ownership.
[info] [dotnetup stdout] Installing .NET SDK 10.0.404 to ~/Library/Application Support/dotnetup/dotnet...
[info] Switching new shells from use-only .NET root "/usr/local/share/dotnet" to dotnetup root "~/Library/Application Support/dotnetup/dotnet" ...
Steps to reproduce
- macOS (arm64). Only the official .NET
.pkgis installed at/usr/local/share/dotnetwith SDKs up to 10.0.301. No dotnetup (~/.dotnetupand~/Library/Application Support/dotnetupabsent), noDOTNET_ROOT, no .NET lines in~/.zshrc. - Open a folder with a
net11.0console project (noglobal.json). - Open C# Doctor. Tooling Requirements is blocked (10.0.301 < 10.0.400) and Correct .NET environment is offered.
- Click it. Doctor reports success and asks to relaunch.
- Inspect
~/.zshrcand relaunch VS Code.
Expected behavior
- Doctor should never write a shell-profile block that points
DOTNET_ROOT/PATHat a root whose SDK does not meet the minimum. The environment fix should only be offered when the target root actually qualifies. - In this setup the single action should be Install .NET SDK (via dotnetup, into the user root), followed by shell setup and a restart/reboot notice.
- When an install switches new shells to the dotnetup root, any existing C# Dev Kit environment block that points elsewhere should be removed.
Related, but separate: for a net11.0 project the first install offered is .NET 10 (product minimum), because project evaluation can't run yet; a second Install .NET 11 SDK step follows after relaunch.
Environment information
- OS: macOS 27.2.1 (arm64)
- VS Code version: 1.146.0
- C# Dev Kit version: 11.11.107 (prerelease)
- C# extension version: 11.11.43 (prerelease)
Additional evidence (optional)
Related: #3809 (asdf SDK below minimum, no Resolve), #3807 (Resolve fails with "selected host changed").
🤖 Filed by an agent on behalf of Jake (@JakeRadMSFT) — reply here with any missing repro detail.
Activity