Unhanlded exception if CWD is deleted
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When the current working directory is deleted (say in another tab), the dotnet commands stop working.
### To Reproduce
0. Open 2 command prompts
1. In prompt 1, cd into a new directory - `~/DotNetTest`
2. In prompt 2, delete that directory
3. 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
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.