dotnet / dotnet/vscode-dotnet-runtime

Bug report: .NET Install Tool returns “unexpected result” and C# extension can’t determine dotnet host architecture

Open
#2,386 1 comment 0 reactions 0 assignees View on GitHub
needs more info
Dominant language
TypeScript
Stars
209
Forks
455
PR merge metrics
No merged PRs in 30d

Description

Summary

The .NET Install Tool in VS Code returns “unexpected result,” and the C# extension reports it “Could not find the architecture of the dotnet host dotnet” and warns about x64 mismatch. The extensions don’t activate properly.
Environment

OS: macOS (Apple Silicon or Intel) [fill in: About This Mac]
Shell: zsh
VS Code: [fill in: Help → About]
Extensions:
ms-dotnettools.csharp: [fill in version]
ms-dotnettools.vscode-dotnet-runtime (.NET Install Tool): [fill in version]
.NET SDK/runtime: [attach output of dotnet --info]
VS Code architecture: [fill in: About dialog shows “Universal/Apple Silicon/Intel”]
Node.js (optional): 22.16.0 observed in console logs
Affected behavior

On startup/activation:
Notification: “The .NET Install Tool returned an unexpected result. Please view the 'Output' → '.NET Install Tool' window for more info.”
C# extension output: “Could not find the architecture of the dotnet host dotnet. If this host does not match the architecture x64, please set PATH to a dotnet host that matches x64. An incorrect architecture will cause instability for the extension ms-dotnettools.csharp.”
Running file $(which dotnet) was executed from terminal; the extensions still fail to detect architecture.
C# tooling features fail to initialize.
Expected behavior

.NET Install Tool completes without errors.
C# extension detects the installed dotnet host’s architecture correctly (arm64 on Apple Silicon or x64 on Intel) and activates normally.
Steps to reproduce

Launch VS Code on macOS with ms-dotnettools.csharp and ms-dotnettools.vscode-dotnet-runtime installed.
Open any workspace (no C# code required to trigger install).
Observe notifications and check Outputs:
View → Output → “.NET Install Tool”
View → Output → “C#” (ms-dotnettools.csharp)
In a terminal, verify dotnet:
which dotnet
file $(which dotnet)
dotnet --info
uname -m
Restart VS Code; issue persists.
Actual results

.NET Install Tool reports “unexpected result.”
C# extension logs architecture detection failure for dotnet, referencing x64 requirement and PATH adjustments.
Logs and diagnostics to attach

Output → “.NET Install Tool” contents.
Output → “C#” (ms-dotnettools.csharp) contents.
Help → Toggle Developer Tools → Console (any errors).
Terminal outputs:
zsh
which dotnet
file $(which dotnet)
dotnet --info
uname -m
echo $PATH
Potential root cause (observed/suspected)

Architecture mismatch or detection failure:
On Apple Silicon, dotnet is often arm64; the extension log references x64, suggesting the extension or runtime is running under different architecture context (e.g., Rosetta), or it fails to resolve symlinks to the actual Mach-O binary.
Conflicting installations (Homebrew vs Microsoft installer) or stale PATH order causing the extension to pick up an unexpected dotnet shim or script.
.NET Install Tool error path not handled gracefully (“unexpected result”).
Workarounds tried

Verified dotnet availability with file $(which dotnet), dotnet --info.
Restarted VS Code and machine.
Ensured PATH includes correct dotnet before other entries.
Suggested fixes (from user perspective)

Clarify architecture requirements in the extension and honor arm64 on Apple Silicon when appropriate.
Improve architecture detection to follow symlinks and handle shell scripts/shims.
Provide actionable guidance in the “unexpected result” error with root cause.
Respect VS Code architecture and avoid enforcing x64 when arm64 is installed and supported.
Impact

Severity: High. C# development features are unavailable/unstable in VS Code for this environment.
Repro artifacts

Project type: non-.NET workspace; error happens at extension activation.
No sensitive data attached.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.