[BUG] On Windows `dotnet` fails to execute many commands due to missing `PROCESSOR_ARCHITECTURE`

Resolved 💬 5 comments Opened Nov 5, 2025 by lostmsu Closed Nov 9, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Many dotnet commands fail due to missing environment variables.

Simplest example: dotnet --info

System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Installer.Windows.InstallerBase' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.

> at Microsoft.DotNet.Installer.Windows.InstallerBase..cctor()

I assume this is because of this line in InstallerBase: https://github.com/dotnet/sdk/blob/2b9fc02a265c735f2132e4e3626e94962e48bdf5/src/Cli/dotnet/Installer/Windows/InstallerBase.cs#L200

Simply running ! echo $PROCESSOR_ARCHITECTURE in Claude confirms bash is not getting the variable: nothing is printed. For example, ! echo $PATH prints the list of variables.

Same for ! pwsh -Command 'echo $env:PROCESSOR_ARCHITECTURE' - prints nothing

What Should Happen?

When Claude calls external tools it must preserve Windows environment variables

Error Messages/Logs

System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Installer.Windows.InstallerBase' threw an exception.
      ---> System.NullReferenceException: Object reference not set to an instance of an object.
        at Microsoft.DotNet.Installer.Windows.InstallerBase..cctor()

Steps to Reproduce

On Windows:

claude --dangerously-skip-permissions
! pwsh -Command 'echo $env:PROCESSOR_ARCHITECTURE'
! pwsh -Command 'echo $env:PATH'
! dotnet --info

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.34 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗