Skip to content

Fix DotNetPath trailing-separator escaping and add detail to dotnet-install failures in InstallDotNetCore - #17115

Merged
ViktorHofer merged 5 commits into
mainfrom
copilot/fix-dotnet-path-issue
Jul 14, 2026
Merged

ViktorHofer merged 5 commits into
mainfrom
copilot/fix-dotnet-path-issue

Conversation

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

InstallDotNetCore had two issues when invoking the dotnet-install script:

  • A trailing directory separator on DotNetPath (common on Windows) escaped the closing quote in -dotnetPath "{DotNetPath}", producing a malformed double-backslash argument.
  • A non-zero exit code logged only "dotnet-install failed", giving no indication of what actually failed.

Changes

  • Trim trailing separators: DotNetPath is stripped of trailing Path.DirectorySeparatorChar/Path.AltDirectorySeparatorChar before being embedded in the quoted argument.
  • Richer failure diagnostics: The failure error now includes the runtime, version, exit code, and full command.
string dotNetPath = DotNetPath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
string arguments = $"-runtime \"{runtime}\" -version \"{normalizedVersion}\" -dotnetPath \"{dotNetPath}\"";
// ...
Log.LogError($"dotnet-install failed for runtime '{runtime}' version '{normalizedVersion}' (exit code {process.ExitCode}). Command: {DotNetInstallScript} {arguments}");

To double check:

Copilot AI requested review from Copilot and removed request for Copilot July 14, 2026 08:15
@ViktorHofer
ViktorHofer marked this pull request as ready for review July 14, 2026 08:15
@ViktorHofer
ViktorHofer enabled auto-merge (squash) July 14, 2026 08:15

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 improves reliability and diagnostics when InstallDotNetCore invokes the dotnet-install script, addressing Windows path quoting edge cases and making failures easier to troubleshoot in build logs.

Changes:

  • Trims trailing directory separators from DotNetPath before embedding it in the quoted -dotnetPath argument to avoid Windows quote-escaping issues.
  • Expands the failure log to include runtime, version, exit code, and the invoked command line.
Show a summary per file
File Description
src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs Adjusts dotnet-install argument construction and enriches failure logging for easier diagnosis.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Copilot AI review requested due to automatic review settings July 14, 2026 08:53
auto-merge was automatically disabled July 14, 2026 08:53

Head branch was pushed to by a user without write access

Copilot AI removed the request for review from Copilot July 14, 2026 08:53
Copilot AI requested review from ViktorHofer and Copilot and removed request for Copilot July 14, 2026 08:57
Copilot AI requested review from Copilot and removed request for Copilot July 14, 2026 09:16
Copilot AI requested review from Copilot and removed request for Copilot July 14, 2026 09:23
@ViktorHofer
ViktorHofer enabled auto-merge (squash) July 14, 2026 18:08
@ViktorHofer
ViktorHofer merged commit 6b4a5f3 into main Jul 14, 2026
9 of 10 checks passed
@ViktorHofer
ViktorHofer deleted the copilot/fix-dotnet-path-issue branch July 14, 2026 18:14
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 15, 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.

4 participants