Skip to content

Fix .NET SDK CLI download timeout#493

Merged
SteveSandersonMS merged 1 commit intomainfrom
stevesa/fix-dotnet-timeout
Feb 17, 2026
Merged

Fix .NET SDK CLI download timeout#493
SteveSandersonMS merged 1 commit intomainfrom
stevesa/fix-dotnet-timeout

Conversation

@SteveSandersonMS
Copy link
Contributor

Summary

Fixes #451.

The \DownloadFile\ MSBuild task defaults to 100s timeout (the .NET HttpClient default), which can cause downloads to fail on slow or unreliable networks.

Changes

  • Set an explicit 600-second (10 minute) timeout on the CLI tarball download
  • Made the timeout configurable via the \CopilotCliDownloadTimeout\ MSBuild property, allowing users to override it in their .csproj\ or \Directory.Build.props\ if needed

Testing

Verified the file still parses as valid XML and the timeout property is correctly applied to the \DownloadFile\ task.

Increase the default timeout for downloading the Copilot CLI tarball from 100s
(the HttpClient default) to 600s (10 minutes) to handle slow or unreliable
network conditions.

The timeout is configurable via the CopilotCliDownloadTimeout MSBuild property.

Fixes #451

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SteveSandersonMS SteveSandersonMS requested a review from a team as a code owner February 17, 2026 13:39
Copilot AI review requested due to automatic review settings February 17, 2026 13:39
@github-actions
Copy link

SDK Consistency Review: ✅ No Action Required

This PR adds a configurable download timeout (default 10 minutes) to the .NET SDK's MSBuild CLI download process, addressing issue #451 where slow networks could cause build failures.

Cross-SDK Analysis

The change is .NET-specific and appropriate because each SDK has a different CLI acquisition strategy:

SDK Acquisition Method Timeout Handling
.NET Downloads at build time (MSBuild) ✅ Now configurable (this PR)
Node.js npm package dependency Handled by npm/registry
Python Downloaded during wheel build Python urllib defaults
Go Downloaded during bundler build Go HTTP client defaults

Finding: Potential Enhancement Opportunity

While this PR correctly addresses the .NET SDK's needs, it does reveal that Python and Go build scripts lack explicit timeout configuration for their CLI downloads. This is not a blocking issue for this PR, but could be considered for future hardening:

  • Python (python/scripts/build-wheels.mjs): Could add signal: AbortSignal.timeout() to fetch calls
  • Go (go/cmd/bundler/main.go): Could configure HTTP client timeout explicitly

Recommendation: Approve this PR as-is. The .NET SDK's configurable timeout makes it more resilient to network issues, which is valuable for enterprise build environments with proxies/firewalls. The other SDKs can consider similar improvements independently if network timeout issues are reported.


This review checked for cross-SDK feature parity and API consistency. No changes needed to other SDKs.

AI generated by SDK Consistency Review Agent

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request attempts to fix issue #451 where the .NET SDK CLI download times out on slow or unreliable networks. The MSBuild DownloadFile task defaults to HttpClient's 100-second timeout, which can be insufficient for downloading the Copilot CLI tarball in some network conditions.

Changes:

  • Added a new MSBuild property CopilotCliDownloadTimeout with a default value of 600 (intended to be 10 minutes)
  • Made the timeout configurable via user's .csproj or Directory.Build.props
  • Applied the timeout to the DownloadFile task using MSBuild property functions
Comments suppressed due to low confidence (1)

dotnet/src/build/GitHub.Copilot.SDK.targets:53

  • The comment states "Timeout in seconds" but users might be confused about whether to specify seconds or milliseconds when overriding this property. Since the MSBuild DownloadFile task expects milliseconds, and this code will multiply the property value by 1000, the comment is correct. However, consider adding a clarifying note in the comment that the SDK automatically converts seconds to milliseconds internally, so users should always specify values in seconds. For example: "Specify the timeout in seconds (the SDK converts to milliseconds internally)."
  <!-- Timeout in seconds for downloading the Copilot CLI tarball.
       Override CopilotCliDownloadTimeout in your .csproj or Directory.Build.props if needed.
       Default is 600 seconds (10 minutes) to handle slow or unreliable network conditions. -->

<MakeDir Directories="$(_CopilotCacheDir)" Condition="!Exists('$(_CopilotCliBinaryPath)')" />
<Message Importance="high" Text="Downloading Copilot CLI $(CopilotCliVersion) for $(_CopilotPlatform)..." Condition="!Exists('$(_CopilotCliBinaryPath)')" />
<DownloadFile SourceUrl="$(_CopilotDownloadUrl)" DestinationFolder="$(_CopilotCacheDir)" DestinationFileName="copilot.tgz"
Timeout="$([System.Int32]::Parse('$(CopilotCliDownloadTimeout)'))"
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MSBuild DownloadFile task's Timeout parameter expects milliseconds, not seconds. The property is documented as "600 seconds (10 minutes)" but passing 600 directly to the Timeout parameter will be interpreted as 600 milliseconds (0.6 seconds), which will cause downloads to fail almost immediately.

The value should be multiplied by 1000 to convert from seconds to milliseconds. For example:
Timeout="$([System.Int32]::Parse('$(CopilotCliDownloadTimeout)') * 1000)"

This ensures that a value of 600 results in a 600,000 millisecond (600 second) timeout.

This issue also appears on line 51 of the same file.

Suggested change
Timeout="$([System.Int32]::Parse('$(CopilotCliDownloadTimeout)'))"
Timeout="$([System.Int32]::Parse('$(CopilotCliDownloadTimeout)') * 1000)"

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +56
<PropertyGroup>
<CopilotCliDownloadTimeout Condition="'$(CopilotCliDownloadTimeout)' == ''">600</CopilotCliDownloadTimeout>
</PropertyGroup>
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding input validation for the CopilotCliDownloadTimeout property to ensure it's a positive integer. Invalid values (negative numbers, zero, or non-numeric strings) could cause build failures with cryptic error messages. You could add a validation target or use MSBuild's Error condition, for example:

<Error Condition="$([System.Int32]::Parse('$(CopilotCliDownloadTimeout)')) &lt;= 0" Text="CopilotCliDownloadTimeout must be a positive integer (in seconds)." />

This would provide users with a clearer error message if they misconfigure the property.

Copilot uses AI. Check for mistakes.
@SteveSandersonMS SteveSandersonMS merged commit e22d235 into main Feb 17, 2026
28 checks passed
@SteveSandersonMS SteveSandersonMS deleted the stevesa/fix-dotnet-timeout branch February 17, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[.NET] Bundled Copilot Cli download times out

1 participant