Skip to content

Attempt to fix dotnet restore hang during prepare step#11282

Open
jonathanpeppers wants to merge 1 commit intomainfrom
jonathanpeppers/fix-restore-hang-in-prepare
Open

Attempt to fix dotnet restore hang during prepare step#11282
jonathanpeppers wants to merge 1 commit intomainfrom
jonathanpeppers/fix-restore-hang-in-prepare

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers commented May 4, 2026

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
Copy link
Copy Markdown
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 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

Comparing the old vs new build logs:

Old build (14008410) — zero stdout from dotnet restore. MSBuild never even printed "Restoring packages for..." before hanging for 10 minutes:

[00:00:18] Running: dotnet "restore" "\"/Users/.../package-download.proj\"" ...
[00:00:19] stderr | Welcome to .NET 11.0!
[00:10:18] Error: Process '...' timed out after 00:10:00

New build (14010260) — restored in 5 seconds:

Restoring packages for .../package-download.proj...
Restored .../package-download.proj (in 5.45 sec).

Can't 100% confirm the quoting fix was the cause vs a transient issue, since the prepare-*.log with the ProcessRunner command line only gets uploaded on failure. But the old build had double-quoted args ("\"/path\"") and MSBuild never started, while the new build completed in 5 seconds.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

2 participants