Description
Describe the bug
When the current working directory is deleted (say in another tab), the dotnet commands stop working.
To Reproduce
- Open 2 command prompts
- In prompt 1, cd into a new directory -
~/DotNetTest - In prompt 2, delete that directory
- In prompt 1, execute
dotnet nuget locals http-cache -c
Exceptions (if any)
System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Cli.Parser' threw an exception.
---> System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Cli.Commands.Test.TestCommandParser' threw an exception.
---> System.IO.FileNotFoundException: Unable to find the specified file.
at Interop.Sys.GetCwdHelper(Byte* ptr, Int32 bufferSize)
at Interop.Sys.GetCwd()
at Microsoft.DotNet.Cli.Commands.Test.TestCommandDefinition.Create()
at Microsoft.DotNet.Cli.Commands.Test.TestCommandParser.CreateCommand()
at Microsoft.DotNet.Cli.Commands.Test.TestCommandParser..cctor()
--- End of inner exception stack trace ---
at Microsoft.DotNet.Cli.Parser..cctor()
--- End of inner exception stack trace ---
at Microsoft.DotNet.Cli.Parser.Parse(String[] args)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
Further technical details
details of dotnet --info
.NET SDK: Version: 10.0.201 Commit: 4d3023de60 Workload version: 10.0.200-manifests.0793c108 MSBuild version: 18.3.0-release-26153-122+4d3023de6
Runtime Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: linux-x64
Base Path: /home/eerhardt/.dotnet/sdk/10.0.201/
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.5
Architecture: x64
Commit: a612c2a105
.NET SDKs installed:
10.0.201 [/home/eerhardt/.dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.5 [/home/eerhardt/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.5 [/home/eerhardt/.dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Activity
mstefarov commentedon May 15, 2026
Just ran into this myself on MacOS. I had the terminal open in the output folder, called a command to clean the solution (which deleted the output folder), and ended up in a "missing working directory" situation. Any
dotnetcommand I typed there (evendotnet --version) gave me this exact error until I changed to an outer directory.dotnet info output (10.0.300)