claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] .NET MSBuild commands (dotnet build/restore/clean) timeout after 2 minutes despite successful completion

Open fouadgm opened this issue 1 year ago • 4 comments

Environment

  • Platform (select one):
    • [x] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.58 (Claude Code)
  • Operating System: macOS Darwin 24.5.0
  • Terminal: Terminal App

Bug Description

.NET MSBuild commands consistently timeout after 2 minutes even though they complete successfully. This appears to be a more specific variant of issue #3505, affecting only certain commands that spawn multiple processes.

Steps to Reproduce

  1. Navigate to any .NET project directory
  2. Run dotnet build using the Bash tool
  3. Observe that the build completes successfully (e.g., in 1.67 seconds)
  4. Wait and observe the "Command timed out after 2m 0.0s" error

Expected Behavior

Commands should return immediately after successful completion without any timeout error.

Actual Behavior

MSBuild commands complete successfully but the Bash tool waits for 2 minutes before timing out:

Command timed out after 2m 0.0s
  Determining projects to restore...
  All projects are up-to-date for restore.
  [... successful build output ...]
Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.67

Additional Context

This issue is related to #3505 but is more specific. Through systematic testing, I found:

Commands that timeout:

  • dotnet build (completes in ~2s, times out after 2m)
  • dotnet restore (completes successfully, times out after 2m)
  • dotnet clean (completes in ~3s, times out after 2m)

Commands that work normally:

  • dotnet --version
  • dotnet --list-sdks
  • All other simple commands (echo, pwd, ls, etc.)
  • Other build tools (npm, make, etc.)

This suggests the issue is specific to commands that:

  1. Spawn multiple child processes (MSBuild)
  2. May leave file handles or streams open after the main process exits
  3. Use the .NET MSBuild engine

The issue makes .NET development workflows frustrating as every build operation requires waiting for a 2-minute timeout.


This issue was discovered and reported through Claude Code's systematic testing of various command types.

fouadgm avatar Jul 23 '25 03:07 fouadgm

Using sudo claude "fixes" the issue, but will cause other permission issues. Reference:

note that sudo claude seems to help with this, at the cost of messing up other operations (commits get created as root for one, and then ssh-agent . I'm also using mise for node+npm, but it persisted when using fnm as well. persists when I do sudo -u $USER claude.

thanks, can confirm this allows claude to run commands (but introduces other problems caused by sudo usage)

Another workaround which doesn't need sudo usage: installing claude using homebrew.

fouadgm avatar Aug 06 '25 04:08 fouadgm

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/3505
  2. https://github.com/anthropics/claude-code/issues/3898
  3. https://github.com/anthropics/claude-code/issues/5687

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 15 '25 21:08 github-actions[bot]

This issue has been automatically closed as a duplicate of #3505.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 19 '25 09:08 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 27 '25 14:08 github-actions[bot]