Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseDotNet crashes while unpacking version #10879

Closed
Foxlider opened this issue Jul 11, 2019 · 11 comments
Closed

UseDotNet crashes while unpacking version #10879

Foxlider opened this issue Jul 11, 2019 · 11 comments
Assignees

Comments

@Foxlider
Copy link

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: UseDotNet

list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

Environment

  • Azure Pipelines
    Account : Keelah Atom
    Team : keelah
    Project name : DiVA
    Build : Foxlider.DiVA #20190711.12

  • Private Agent
    Windows Server 2019 10.0.17763
    Version 2.153.2

Issue Description

While trying to download Dotnet 3.0.100-preview6 for my project by using UseDotNet@2 I get the following for every build I tried :
image
And this is the content of my _temp folder
image

I really don't understand what is happening or even what it tries to do...

Error logs

##[section]Starting: UseDotNet
==============================================================================
Task         : Use dotnet
Description  : Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
Version      : 2.0.10
Author       : Microsoft Corporation
Help         : https://aka.ms/AA4xgy0
==============================================================================
Tool to install: .NET Core sdk version 3.0.100-preview6-012264.
Found version 3.0.100-preview6-012264 in channel 3.0 for user specified version spec: 3.0.100-preview6-012264
Version 3.0.100-preview6-012264 was not found in cache.
Getting URL to download .NET Core sdk version: 3.0.100-preview6-012264.
Detecting OS platform to find correct download package for the OS.
[command]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'C:\Users\Administrator.KEELAHSERVER\Documents\KeelahReleases\_tasks\UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6\2.0.10\externals\get-os-platform.ps1'"
Primary:win-x64
Detected platform (Primary): win-x64
Downloading: https://download.visualstudio.microsoft.com/download/pr/4e73514f-0646-4600-bdc2-38c90fc207b6/22ad70cbe1a254177e6d7b7f7e7425f8/dotnet-sdk-3.0.100-preview6-012264-win-x64.zip
Extracting downloaded package C:\Users\Administrator.KEELAHSERVER\Documents\KeelahReleases\_temp\375a82dd-4435-4de1-8569-e7b30f006634.
Extracting archive
[command]C:\Windows\system32\chcp.com 65001
Active code page: 65001
[command]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\Users\Administrator.KEELAHSERVER\Documents\KeelahReleases\_temp\375a82dd-4435-4de1-8569-e7b30f006634', 'C:\Users\Administrator.KEELAHSERVER\Documents\KeelahReleases\_temp\6f55e40c-70e2-43a3-952f-3dd680aa99a0')"
Exception calling "ExtractToDirectory" with "2" argument(s): "Could not find a part of the path 'C:\Users\Administrator
.KEELAHSERVER\Documents\KeelahReleases\_temp\6f55e40c-70e2-43a3-952f-3dd680aa99a0\sdk\3.0.100-preview6-012264\DotnetToo
ls\dotnet-user-secrets\3.0.0-preview6.19307.2\tools\netcoreapp3.0\any\Microsoft.Extensions.Configuration.Abstractions.d
ll'."
At line:1 char:111
+ ... catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\U ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DirectoryNotFoundException
 
##[error]Failed while installing version: 3.0.100-preview6-012264 at path: C:\Users\Administrator.KEELAHSERVER\Documents\KeelahReleases\_tool/dotnet with error: Failed while extracting downloaded package with error: Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
##[section]Finishing: UseDotNet
@ghost ghost assigned sachinma Jul 11, 2019
@vineetmimrot
Copy link
Member

Hey @Foxlider ,
Thanks for reporting the issue and giving enough information to debug this. I have tried out same version of the dotnet on private agent and it is working fine. So there may be one of the following issue

  1. The dotnet sdk file may not have downloaded properly. --> Can you please take SHA512 checksum of the downloaded file (i.e. C:\Users\Administrator.KEELAHSERVER\Documents\KeelahReleases_temp\375a82dd-4435-4de1-8569-e7b30f006634) and compare with value present here.

  2. There might not have sufficient disk space.

Can you please check above things and reply.

@hiyadav
Copy link
Contributor

hiyadav commented Jul 17, 2019

Hey @Foxlider
Were you able to follow the above mentioned suggestions ?

@Foxlider
Copy link
Author

I checked a few times and I still have enough space on the drive.
The checksums were corrects as well each time.

@hiyadav
Copy link
Contributor

hiyadav commented Aug 1, 2019

The behaviour seems odd, as this error is not seen on a hosted agent.

This error is thrown by PowerShell when it is unable to access either of the paths.
One possibility where this can happen is, if the downloaded package is locked by some program (like an antivirus), making it unavailable to be extracted.
Another possibility can be that the drive/path is mounted and thus might be causing problem.

Usually, temp path's are in exemption list of antiviruses, can you verify that ?

@Foxlider
Copy link
Author

Foxlider commented Aug 2, 2019

The agent is installed on my own WindowsServer 2019 freshly installed.

I will try again with .NET v3.0.100-preview7-012821 see if it works

@Foxlider
Copy link
Author

Foxlider commented Aug 2, 2019

After a few try I still can't set it up...
Can't tell the UseDotnet to install to a specific directlry. Tried InstallDir and WorkingDirectory but still get errors

@anuragc617
Copy link
Contributor

You can give any path to dotNetCore Installer given that the agent has access to that. The default path is $(Agent.ToolsDirectory)
Can you try installing your agent to some other directory having shorter path length? I have been able to reproduce this issue with the agent installed directory path as long as yours. This is failing because PowerShell is not able to extract because of the long path to extract.

@LMSSonos
Copy link

LMSSonos commented Aug 9, 2019

Same issue for me as well

\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile 
-NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { 
Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; 
[System.IO.Compression.ZipFile]::ExtractToDirectory('c:\agent\_work\_temp\123678d0-91c9-4c3d-9dac-f2c4f06d2c16', 'c:\agent\_work\_temp\c4ac1e2f-98f0-457c-b12f-8c377f6dc582')"

Exception calling "ExtractToDirectory" with "2" argument(s): "There is not enough space on the disk"

Same issue with DotNetCoreInstaller@0

@anuragc617
Copy link
Contributor

@LMSSonos from the error, it looks like a memory issue. Can you please verify that you have enough memory to extract the downloaded dotnet core sdk zip?

@anuragc617
Copy link
Contributor

Merged PR to fix long path extraction error. Closing this issue.

@bartvanhoey
Copy link

bartvanhoey commented Sep 25, 2024

Taks UseDotNet@2 throws DirectoryNotFoundException when extracting downloaded package by Powershell

  • task: UseDotNet@2
    displayName: 'Install .NET9'
    inputs:
    version: 9.0.100-preview.1.24101.2

Zu installierendes Tool: .NET Core sdk Version 9.0.100-preview.1.24101.2.
Version 9.0.100-preview.1.24101.2 in Kanal "9.0" für benutzerseitig angegebene Versionsspezifikation gefunden: 9.0.100-preview.1.24101.2
Die Version 9.0.100-preview.1.24101.2 wurde nicht im Cache gefunden.
URL zum Herunterladen von .NET Core sdk, Version 9.0.100-preview.1.24101.2 wird abgerufen.
Die Betriebssystemplattform wird ermittelt, um das richtige Downloadpaket für das Betriebssystem zu finden.
[command]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'C:\Users\WlodarczykD\Desktop\Agent_work_tasks\UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6\2.0.7\externals\get-os-platform.ps1'"
Primary:win-x64
Erkannte Plattform (primär): win-x64
Wird heruntergeladen: https://download.visualstudio.microsoft.com/download/pr/4c55bc67-e478-4fdc-abe3-08b8dd64f4e4/9cf46c3018f477a93a8498850e6c122b/dotnet-sdk-9.0.100-preview.1.24101.2-win-x64.zip
Das heruntergeladene Paket C:\Users\WlodarczykD\Desktop\Agent_work_temp\a99876a3-aa84-433e-bf83-64fc670a2c62 wird extrahiert.
Archiv wird extrahiert
[command]C:\Windows\system32\chcp.com 65001
Active code page: 65001
[command]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\Users\WlodarczykD\Desktop\Agent_work_temp\a99876a3-aa84-433e-bf83-64fc670a2c62', 'C:\Users\WlodarczykD\Desktop\Agent_work_temp\a846e048-8cb7-48a7-b9a1-6592eece6719')"
Exception calling "ExtractToDirectory" with "2" argument(s): "Could not find a part of the path 'C:\Users\WlodarczykD\D
esktop\Agent_work_temp\a846e048-8cb7-48a7-b9a1-6592eece6719\sdk\9.0.100-preview.1.24101.2\DotnetTools\dotnet-watch\9.
0.100-preview.1.24101.1\tools\net9.0\any\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe.confi
g'."
At line:1 char:111

  • ... catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\U ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : DirectoryNotFoundException

##[error]Fehler beim Installieren der Version 9.0.100-preview.1.24101.2 in Pfad "C:\Users\WlodarczykD\Desktop\Agent_work_tool/dotnet". Fehler: Fehler beim Extrahieren des heruntergeladenen Pakets. Fehler: Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
##[section]Abschließen: Install .NET9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants