actions / setup-dotnet

Set up your GitHub Actions workflow with a specific version of the .NET core sdk
MIT License
922 stars 454 forks source link

ParentContainsErrorRecordException, The process cannot access the file 'C:\Program Files\dotnet\dotnet.exe' because it is being used by another process. #387

Closed IhateTrains closed 1 year ago

IhateTrains commented 1 year ago

Description: setup-dotnet action fails with ParentContainsErrorRecordException: https://github.com/ParadoxGameConverters/ImperatorToCK3/actions/runs/4262267753/jobs/7417899979

Task version: v3

Platform:

Runner type:

Repro steps:
Use setup-dotnet to set up up NET 6 and do something with it. In the next steps, use setup-dotnet again to set up .NET 7. Example: https://github.com/ParadoxGameConverters/ImperatorToCK3/actions/runs/4262267753/jobs/7417899979

Expected behavior: The action should set up .NET 7.

Actual behavior: I'm getting the following exception:

dotnet-install: Failed to extract package. Exception: Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file 'C:\Program Files\dotnet\dotnet.exe' because it is being used by another process."
ParentContainsErrorRecordException: D:\a\_actions\actions\setup-dotnet\v3\externals\install-dotnet.ps1:816
Line |
 816 |  …             [System.IO.Compression.ZipFileExtensions]::ExtractToFile( …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file 'C:\Program
     | Files\dotnet\dotnet.exe' because it is being used by another process."
panticmilos commented 1 year ago

hi @IhateTrains, thank you for the report, we will take a look at it :)

bhargavgaglani07 commented 1 year ago

We are facing same issue with Self-hosted runner. Kindly note that it works with v2, and also was working with v3 few days back.

dotnet-install: Extracting the archive.
dotnet-install: Failed to extract package. Exception: Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file 'C:\Program Files\dotnet\dotnet.exe' because it is being used by another process."
Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file 'C:\Program 
Files\dotnet\dotnet.exe' because it is being used by another process."
....
+ ...             [System.IO.Compression.ZipFileExtensions]::ExtractToFile( ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : IOException
nikolai-laevskii commented 1 year ago

The fix is already on its way and will be included in closest release.

If you don't have time to wait you may temporarily adjust your workflow to install several versions of dotnet at once instead of calling action several times: https://github.com/actions/setup-dotnet#usage.

Thank you for reporting the issue and providing a very comprehensive and detailed description!