Unhandled exception: System.IO.IOException: Access to the path '...\build\tools\.store\.stage\ftb2snwd.f5x' is denied.
- Dominant language
- C#
- Stars
- 4.2k
- Forks
- 778
- Avg merge
- 3h 37m
- Merged PRs (30d)
- 21
Description
### Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched [issues](https://github.com/cake-build/cake/issues) to ensure it has not already been reported
### Cake runner
Cake Frosting
### Cake version
4.0.0
### Operating system
Windows
### Operating system architecture
64-Bit
### CI Server
_No response_
### What are you seeing?
This happens when a Cake Frosting program has `InstallTool` with `dotnet`.
Visual Studio hold the `...\build\tools\.store\.stage` hostage:
```
Installing tools...
Installing tool 'Microsoft.Sbom.DotNetTool'...
Configured Tools Folder: .../build/tools
Executing: "dotnet" tool list --tool-path ".../build/tools"
Package Id Version Commands
-------------------------------------
There are 0 dotnet tools installed
Checking for tool: microsoft.sbom.dotnettool
Running dotnet tool with operation Install: Microsoft.Sbom.DotNetTool...
Executing: "dotnet" tool install "Microsoft.Sbom.DotNetTool" --tool-path "C:/src/services-platform/connext/connector_demo_1/build/tools" --version 2.* --verbosity diagnostic
Unhandled exception: System.IO.IOException: Access to the path '...\build\tools\.store\.stage\by43pdyi.4ao' is denied.
at System.IO.FileSystem.MoveDirectory(String sourceFullPath, String destFullPath, Boolean _)
at System.IO.FileSystem.MoveDirectory(String sourceFullPath, String destFullPath)
at Microsoft.DotNet.Cli.Utils.FileAccessRetrier.RetryOnMoveAccessFailure(Action action)
at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass20_0.b__1()
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
```
This doesn't happen when using `InstallTool` with `nuget`.
### What is expected?
This happens with this simple program:
```csharp
public static class Program
{
public static int Main(string[] args)
{
return new CakeHost()
.InstallTool(new Uri("dotnet:?package=Microsoft.Sbom.DotNetTool&version=2.*"))
.Run(args);
}
}
```
### Steps to Reproduce
This happens when a Cake Frosting program has `InstallTool` with `dotnet`.
Visual Studio hold the `...\build\tools\.store\.stage` hostage.
This doesn't happen when using `InstallTool` with `nuget`.
### Output log
```
Installing tools...
Installing tool 'Microsoft.Sbom.DotNetTool'...
Configured Tools Folder: .../build/tools
Executing: "dotnet" tool list --tool-path ".../build/tools"
Package Id Version Commands
-------------------------------------
There are 0 dotnet tools installed
Checking for tool: microsoft.sbom.dotnettool
Running dotnet tool with operation Install: Microsoft.Sbom.DotNetTool...
Executing: "dotnet" tool install "Microsoft.Sbom.DotNetTool" --tool-path "C:/src/services-platform/connext/connector_demo_1/build/tools" --version 2.* --verbosity diagnostic
Unhandled exception: System.IO.IOException: Access to the path '...\build\tools\.store\.stage\by43pdyi.4ao' is denied.
at System.IO.FileSystem.MoveDirectory(String sourceFullPath, String destFullPath, Boolean _)
at System.IO.FileSystem.MoveDirectory(String sourceFullPath, String destFullPath)
at Microsoft.DotNet.Cli.Utils.FileAccessRetrier.RetryOnMoveAccessFailure(Action action)
at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass20_0.b__1()
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
```
Contributor guide
Research direction
Reproduce the Cake Frosting program shown in the issue on 64-bit Windows with Cake 4.0.0 and the Microsoft.Sbom.DotNetTool installation. Start at CakeHost.InstallTool with the dotnet tool path and compare its behavior with the nuget installer while Visual Studio is present. Done means the dotnet tool installs without the IOException involving build/tools/.store/.stage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100