Skip to content

[REGRESSION]: UseDotNet fails with 'TypeError: paths.flat is not a function' when installing new SDK #21085

Closed
@postsebu

Description

@postsebu

New issue checklist

Task name

UseDotNet

Breaking task version

2.256.0

Last working task version

2.254.1

Regression Description

when running UseDotNet@2.256.0 on windows based self-hosted agent we got following error, first time on June 6th 2025:

log-line from initialize job step:
Current agent version: '2.202.1'

logs from usedotnet task:
##[error]Failed while installing version: 8.0.411 at path: C:\azagent\A2_work_tool/dotnet with error: TypeError: paths.flat is not a function`

for now pinned the version to UseDotNet@2.254.1 which works for us.

I noticed a recent issue with a similar error message but for a different task, not sure if it's related: #21048

please notice: the task only failed if the SDK version was not found in cache and it tried to installed the new version.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows Server 2022 Datacenter Version

Relevant log output

2025-06-16T06:54:19.4695146Z Tool to install: .NET Core sdk version 8.x.
2025-06-16T06:54:19.6140729Z Found version 8.0.411 in channel 8.0 for user specified version spec: 8.x
2025-06-16T06:54:19.7334650Z Version 8.0.411 was not found in cache.
2025-06-16T06:54:19.7339043Z Getting URL to download .NET Core sdk version: 8.0.411.
2025-06-16T06:54:19.8123928Z Detecting OS platform to find correct download package for the OS.
2025-06-16T06:54:19.8125333Z [command]C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'C:\azagent\A2\_work\_tasks\UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6\2.256.0\externals\get-os-platform.ps1'"
2025-06-16T06:54:20.5028591Z Primary:win-x64
2025-06-16T06:54:20.5031551Z Detected platform (Primary): win-x64
2025-06-16T06:54:20.5072525Z Downloading: https://builds.dotnet.microsoft.com/dotnet/Sdk/8.0.411/dotnet-sdk-8.0.411-win-x64.zip
2025-06-16T06:54:24.4468853Z Extracting downloaded package C:\azagent\A2\_work\_temp\716dcbe5-24b6-4f6f-a7c1-92534b8fef5d.
2025-06-16T06:54:24.4474358Z Extracting archive
2025-06-16T06:54:24.4503862Z [command]C:\WINDOWS\system32\chcp.com 65001
2025-06-16T06:54:24.4801290Z Active code page: 65001
2025-06-16T06:54:24.4878654Z [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:\azagent\A2\_work\_temp\716dcbe5-24b6-4f6f-a7c1-92534b8fef5d', 'C:\azagent\A2\_work\_temp\8335')"
2025-06-16T06:55:05.0751781Z ##[error]Failed while installing version: 8.0.411 at path: C:\azagent\A2\_work\_tool/dotnet with error: TypeError: paths.flat is not a function
2025-06-16T06:55:05.0853279Z ##[section]Finishing: Use .NET SDK 8.x

Full task logs with system.debug enabled

UNSUCCESSFUL RUN
 
2025-06-16T06:54:15.2517115Z ##[section]Starting: Use .NET SDK 8.x
2025-06-16T06:54:15.2826032Z ==============================================================================
2025-06-16T06:54:15.2826430Z Task         : Use .NET Core
2025-06-16T06:54:15.2827942Z 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.
2025-06-16T06:54:15.2828661Z Version      : 2.256.0
2025-06-16T06:54:15.2828956Z Author       : Microsoft Corporation
2025-06-16T06:54:15.2829275Z Help         : https://aka.ms/AA4xgy0
2025-06-16T06:54:15.2829655Z ==============================================================================
2025-06-16T06:54:19.4695146Z Tool to install: .NET Core sdk version 8.x.
2025-06-16T06:54:19.6140729Z Found version 8.0.411 in channel 8.0 for user specified version spec: 8.x
2025-06-16T06:54:19.7334650Z Version 8.0.411 was not found in cache.
2025-06-16T06:54:19.7339043Z Getting URL to download .NET Core sdk version: 8.0.411.
2025-06-16T06:54:19.8123928Z Detecting OS platform to find correct download package for the OS.
2025-06-16T06:54:19.8125333Z [command]C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'C:\azagent\A2\_work\_tasks\UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6\2.256.0\externals\get-os-platform.ps1'"
2025-06-16T06:54:20.5028591Z Primary:win-x64
2025-06-16T06:54:20.5031551Z Detected platform (Primary): win-x64
2025-06-16T06:54:20.5072525Z Downloading: https://builds.dotnet.microsoft.com/dotnet/Sdk/8.0.411/dotnet-sdk-8.0.411-win-x64.zip
2025-06-16T06:54:24.4468853Z Extracting downloaded package C:\azagent\A2\_work\_temp\716dcbe5-24b6-4f6f-a7c1-92534b8fef5d.
2025-06-16T06:54:24.4474358Z Extracting archive
2025-06-16T06:54:24.4503862Z [command]C:\WINDOWS\system32\chcp.com 65001
2025-06-16T06:54:24.4801290Z Active code page: 65001
2025-06-16T06:54:24.4878654Z [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:\azagent\A2\_work\_temp\716dcbe5-24b6-4f6f-a7c1-92534b8fef5d', 'C:\azagent\A2\_work\_temp\8335')"
2025-06-16T06:55:05.0751781Z ##[error]Failed while installing version: 8.0.411 at path: C:\azagent\A2\_work\_tool/dotnet with error: TypeError: paths.flat is not a function
2025-06-16T06:55:05.0853279Z ##[section]Finishing: Use .NET SDK 8.x
 
SUCCESSFUL RUN
 
2025-06-16T08:02:07.8244866Z ##[section]Starting: Use .NET SDK 8.x
2025-06-16T08:02:07.8520960Z ==============================================================================
2025-06-16T08:02:07.8521404Z Task         : Use .NET Core
2025-06-16T08:02:07.8522101Z 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.
2025-06-16T08:02:07.8523402Z Version      : 2.254.1
2025-06-16T08:02:07.8523729Z Author       : Microsoft Corporation
2025-06-16T08:02:07.8524052Z Help         : https://aka.ms/AA4xgy0
2025-06-16T08:02:07.8524430Z ==============================================================================
2025-06-16T08:02:15.6068300Z Tool to install: .NET Core sdk version 8.x.
2025-06-16T08:02:15.7545950Z Found version 8.0.411 in channel 8.0 for user specified version spec: 8.x
2025-06-16T08:02:15.8185529Z Version 8.0.411 was not found in cache.
2025-06-16T08:02:15.8187496Z Getting URL to download .NET Core sdk version: 8.0.411.
2025-06-16T08:02:15.8195721Z Detecting OS platform to find correct download package for the OS.
2025-06-16T08:02:15.8207021Z [command]C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "& 'C:\azagent\A2\_work\_tasks\UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6\2.254.1\externals\get-os-platform.ps1'"
2025-06-16T08:02:16.6432693Z Primary:win-x64
2025-06-16T08:02:16.6434560Z Detected platform (Primary): win-x64
2025-06-16T08:02:16.6462794Z Downloading: https://builds.dotnet.microsoft.com/dotnet/Sdk/8.0.411/dotnet-sdk-8.0.411-win-x64.zip
2025-06-16T08:02:20.4797934Z Extracting downloaded package C:\azagent\A2\_work\_temp\1c5ee99e-411d-4929-8543-225502c68aea.
2025-06-16T08:02:20.4848406Z Extracting archive
2025-06-16T08:02:20.4866145Z [command]C:\WINDOWS\system32\chcp.com 65001
2025-06-16T08:02:20.5002646Z Active code page: 65001
2025-06-16T08:02:20.5124730Z [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:\azagent\A2\_work\_temp\1c5ee99e-411d-4929-8543-225502c68aea', 'C:\azagent\A2\_work\_temp\82ec')"
2025-06-16T08:03:33.2905394Z Successfully installed .NET Core sdk version 8.0.411.
2025-06-16T08:03:33.2959841Z Creating global tool path and pre-pending to PATH.
2025-06-16T08:03:33.3008271Z ##[section]Finishing: Use .NET SDK 8.x
 

sorry, I could not run the pipelines again with system.debug enabled since the SDK installation already happened successfully after we pinned down the UseDotNet task version.

Repro steps

# we use the usedotnet task in a deployment job, I'm afraid I cannot disclose the rest of the stage/job
steps:
  - task: UseDotNet@2
    inputs:
      version: 8.x

Metadata

Metadata

Assignees

Labels

Area: ABTTAkvelon Build Tasks Team area of workbugregressionThis used to work, but a change in the service/tasks broke it.triage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions