Skip to content

[release/10.0.1xx] Fix dotnet restore hang during prepare step#11350

Open
jonathanpeppers wants to merge 2 commits into
release/10.0.1xxfrom
jonathanpeppers/cherry-pick-to-10-0-1xx
Open

[release/10.0.1xx] Fix dotnet restore hang during prepare step#11350
jonathanpeppers wants to merge 2 commits into
release/10.0.1xxfrom
jonathanpeppers/cherry-pick-to-10-0-1xx

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

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

jonathanpeppers and others added 2 commits May 14, 2026 15:41
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>
* Increase ProcessTimeout for runtime pack restore to 30 minutes

The dotnet restore of package-download.proj downloads ~18 NuGet runtime
packs and workload manifests. The default ProcessRunner timeout of 10
minutes is not enough on slower CI machines, causing all 3 retry attempts
to time out and the entire Step_InstallDotNetPreview to fail.

Increase the ProcessTimeout to 30 minutes for this specific restore.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix dotnet restore hang in Step_InstallDotNetPreview

Three changes to address the recurring restore hang on macOS CI:

1. Kill entire process tree on timeout: process.Kill() only kills the
   top-level dotnet process, leaving orphaned MSBuild worker nodes
   alive. These can hold locks that block subsequent retry attempts.
   Use process.Kill(entireProcessTree: true) instead.

2. Replace DOTNET_SKIP_FIRST_TIME_EXPERIENCE (ignored since .NET 5)
   with DOTNET_NOLOGO and DOTNET_GENERATE_ASPNET_CERTIFICATE=false.
   The first-run experience still runs ASP.NET cert generation on
   macOS which involves keychain operations that can hang on CI.

3. Revert the 30-minute ProcessTimeout since 10 minutes is already
   generous for a restore that should take seconds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 14, 2026 20:42
@jonathanpeppers jonathanpeppers changed the base branch from main to release/10.0.1xx May 14, 2026 20:42
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

Cherry-picks fixes onto release/10.0.1xx to reduce the likelihood of dotnet restore hanging during the CI prepare phase, improving reliability of workload/runtime pack restoration and timeout cleanup.

Changes:

  • Add retry/backoff and more verbose/echoed output when restoring package-download.proj runtime packs in xaprepare.
  • Ensure timed-out processes are terminated via Kill(entireProcessTree: true) to prevent orphaned child processes.
  • Add pipeline variables to suppress first-run banner/side effects (telemetry, logo, ASP.NET cert generation).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs Adds retry loop with per-attempt binlogs and stdout/stderr echo for runtime pack restore.
build-tools/xaprepare/xaprepare/Application/ProcessRunner.cs Switches timeout termination to kill the full process tree.
build-tools/automation/yaml-templates/variables.yaml Adds dotnet-related environment variables to reduce first-run friction/hangs on CI.

Comment thread build-tools/xaprepare/xaprepare/Application/ProcessRunner.cs
@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 14, 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