Attempt to fix `dotnet restore` hang during prepare step by jonathanpeppers · Pull Request #11282 · dotnet/android · GitHub
Skip to content

Attempt to fix dotnet restore hang during prepare step#11282

Merged
simonrozsival merged 1 commit into
mainfrom
jonathanpeppers/fix-restore-hang-in-prepare
May 6, 2026
Merged

Attempt to fix dotnet restore hang during prepare step#11282
simonrozsival merged 1 commit into
mainfrom
jonathanpeppers/fix-restore-hang-in-prepare

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented May 4, 2026

Copy link
Copy Markdown
Member

Build 14008410 failed during the prepare phase because dotnet restore of package-download.proj timed out after 10 minutes on all 3 attempts, with zero stdout output — indicating the process was hanging, not just slow.

While investigating, we found two things that look wrong and might help:

  1. Double-quoting of arguments: ProcessRunner.QuoteArgument() was called before passing args to the ProcessRunner constructor, but the constructor already quotes all arguments via AddQuotedArgument(). This caused paths to be double-quoted (e.g. "\"/path/to/file\"").

  2. Missing DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true in the shared pipeline variables — the first-run experience was triggering on CI (we saw the "Welcome to .NET 11.0!" banner on stderr right before the hang).

The `dotnet restore` of `package-download.proj` was hanging during
the prepare phase, causing all 3 retry attempts to time out after
10 minutes each with zero stdout output.

Two issues fixed:

1. Double-quoting of arguments: `ProcessRunner.QuoteArgument()` was
   called before passing args to the `ProcessRunner` constructor,
   but the constructor already quotes all arguments via
   `AddQuotedArgument()`. This caused paths to be wrapped in
   double quotes (e.g. `"\"/path/to/file\""`), which could cause
   `dotnet restore` to hang trying to resolve an invalid path.

2. Added `DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true` to the shared
   pipeline variables so all CI pipelines skip the .NET first-run
   experience, which can also hang on CI agents.

Fixes: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=14008410

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 4, 2026 19:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a CI hang during the prepare phase by ensuring dotnet restore is invoked with correctly quoted arguments and by disabling the .NET first-time experience across pipelines. It fits into the xaprepare/automation infrastructure that bootstraps SDK/tooling dependencies reliably in CI.

Changes:

  • Stop pre-quoting arguments passed to ProcessRunner in Step_InstallDotNetPreview, avoiding double-quoting on the final command line.
  • Add DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true to shared Azure Pipelines variables to reduce the risk of first-run stalls during restore.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs Removes explicit QuoteArgument() usage so ProcessRunner performs quoting exactly once.
build-tools/automation/yaml-templates/variables.yaml Adds DOTNET_SKIP_FIRST_TIME_EXPERIENCE to shared pipeline variables to avoid first-run behavior in CI.

@jonathanpeppers jonathanpeppers changed the title Fix dotnet restore hang during prepare step Attempt to fix dotnet restore hang during prepare step May 4, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member Author

@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label May 5, 2026
@simonrozsival simonrozsival merged commit be52eed into main May 6, 2026
7 checks passed
@simonrozsival simonrozsival deleted the jonathanpeppers/fix-restore-hang-in-prepare branch May 6, 2026 08:21
jonathanpeppers added a commit that referenced this pull request May 15, 2026
…11350)

Cherry-picks two fixes from `main` to `release/10.0.1xx`:

- be52eed Fix dotnet restore hang during prepare step (#11282)
- 63b2e68 Fix dotnet restore hang in Step_InstallDotNetPreview (#11310)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants