Skip to content

Fix dotnetup bootstrap fallback on Unix - #55145

Merged
nagilson merged 5 commits into
dotnet:mainfrom
nagilson:nagilson/dotnetup-bootstrap-fallback
Jul 6, 2026
Merged

nagilson merged 5 commits into
dotnet:mainfrom
nagilson:nagilson/dotnetup-bootstrap-fallback

Conversation

@nagilson

@nagilson nagilson commented Jul 6, 2026 •

Copy link
Copy Markdown
Member

Addresses the first part of #55136.

restore-toolset was made to not exit with a failure code so the .NET Install script fallback would work. But restore-toolset is only called when we begin to run tests.

The configure-toolset is a different script, and it exists because we need to install the SDK first so that arcade itself can download (we run dotnet msbuild against the arcade toolset project.)

Its call to get dotnetup and run it was not fixed with those same protections. This makes the dotnetup acquisition and run not fail or cause any side-effects if it fails. This allows the builtin call to the .NET Install scripts to work as a fallback which is how arcade normally gets set up, but arcade's logic to do that doesn't run if the sdk already exists, preventing redundant work.

Copilot AI review requested due to automatic review settings July 6, 2026 16:08

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

Updates the Unix toolset bootstrap path so that dotnetup failures during bootstrap do not fail InitializeToolset, allowing Arcade’s normal dotnet-install fallback logic to proceed (#55136).

Changes:

  • Return early (without failing the script) when dotnetup acquisition fails, enabling the standard fallback path.
  • Temporarily disable errexit around dotnetup sdk install to capture the exit code reliably.
  • Return early on dotnetup sdk install failure so InitializeDotNetCli can fall back to dotnet-install.

Comment thread eng/configure-toolset.sh Resolved
Comment thread eng/configure-toolset.sh Resolved
@nagilson
nagilson marked this pull request as draft July 6, 2026 16:11
@nagilson
nagilson force-pushed the nagilson/dotnetup-bootstrap-fallback branch from dc8ce4a to 23bb8cc Compare July 6, 2026 16:13
@nagilson
nagilson marked this pull request as ready for review July 6, 2026 17:28
nagilson and others added 3 commits July 6, 2026 11:31
Route the dotnetup 'sdk install' and 'runtime install' native invocations in
configure-toolset.ps1 and restore-toolset.ps1 through a new shared helper,
Invoke-DotnetupNativeCommand, in dotnetup-shared.ps1.

The helper locally neutralizes both \Continue ('Stop' from the
build host) and \False (defaults \True on
PowerShell 7.4+) so a non-zero native exit code cannot become a terminating
error that bypasses the graceful fallback. A genuine throw (e.g. missing
executable) is caught and surfaced as a non-zero exit code. It returns the
process exit code for the caller's existing fallback check.

Co-authored-by: Copilot <[email protected]>
The identical 'save \$-, set +e, run, capture \True, restore set -e' block was
copy-pasted in three places (configure-toolset.sh dotnetup sdk install,
restore-toolset.sh dotnetup runtime install, and the dotnet-install fallback).
Factor it into a shared RunWithoutErrexit helper in dotnetup-shared.sh (the
shell counterpart to Invoke-DotnetupNativeCommand in dotnetup-shared.ps1). It
returns the wrapped command's exit code via the global _RunWithoutErrexit,
following the _<FunctionName> return convention already used for
_GetDotNetInstallScript, and always returns 0 itself so callers can invoke it
as a plain command under 'set -e'.

Co-authored-by: Copilot <[email protected]>
@nagilson
nagilson requested a review from a team July 6, 2026 20:26
@nagilson
nagilson enabled auto-merge July 6, 2026 20:26
@nagilson
nagilson merged commit a07f31f into dotnet:main Jul 6, 2026
25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 7, 2026
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.

3 participants