Repository navigation
Conversation
|
Note PRs from original repository included in this codeflow update:
💡 You may consult the FAQ for more information or tag @dotnet/prodconsvcs for assistance. |
|
failure otnet-unified-build (VMR Vertical Build Windows_x64):
rerunning |
|
hm rerun didn't help, copilot diagnosed as bad path quoting in msbuild targets, uncovered intermittently |
…tCoreTask Fixes bootstrap SDK acquisition failing when DotNetRoot contains a space (e.g. C:\Program Files\dotnet). The PowerShell -File <scriptPath> and -InstallDir <dir> arguments were unquoted, so PowerShell parsed -File C:\Program and failed with "Install-scripts was not executed successfully" (BootStrapMsBuild.targets(243,5)) on the VMR Windows legs. Co-authored-by: Copilot <[email protected]>
Added fix commit: quote the bootstrap
|
| Build | DotNetRoot |
AcquireSdk result |
|---|---|---|
| 2992333 (Windows ✅) | D:\a\_work\1\s\.dotnet\ — repo-local, no space |
dotnet-install ran, "Installed version is 10.0.300", success |
| 2992647 (Windows ❌) | C:\Program Files\dotnet\ — global, has a space |
-File C:\Program → parse error → failure |
DotNetRoot is provided by Arcade and points at the SDK location used for the build. It flipped from the repo-local .dotnet (space-free) to the machine-global C:\Program Files\dotnet (with a space). The unquoted-path bug only bites when that path contains a space — so the path change is precisely what turned the dormant bug active.
Why it looked intermittent
InstallDotNetCoreTask.Execute() early-returns when InstallDir\sdk\<version> already exists, so it only runs the broken PowerShell command on a clean install dir. Note the msbuild source was identical between the passing (Jun 4 19:35) and failing (Jun 5 03:07) builds — none of the commits in between touch msbuild — confirming this was an environment/SDK-location change, not a code regression in that window. Likewise, this PR's source range (f69fa2f→f14c0d5: ToolTask/NodeLauncher/analyzers/loc) does not touch the bootstrap path; it's just the right open msbuild-flow PR to carry the fix.
Net
- IBC
drop.exe 1244(issue [Operational Issue]: drop.exe exit 1244 acquiring VS optimization data (vs18.6) on 10.0.3xx/10.0.4xx Windows legs #6954) is fixed and unrelated to this. - This failure = unquoted
-File/-InstallDirinInstallDotNetCoreTask, exposed whenDotNetRootbecameC:\Program Files\dotnet. Fixed by quoting (782bde4).
…rap install The previous quoting fix exposed a second defect: InstallDir ends with a directory separator ($(ArtifactsBinDir)bootstrap\core\), so the quoted `-InstallDir "...\core\"` had its trailing `\"` escape the closing quote on Windows, corrupting the path to `...\core"` (dotnet-install reported "doesn't have write access to the installation root" / "Illegal characters in path"). Trim trailing separators (root-preserving) before quoting. Validated locally against powershell.exe using the same ToolTask process invocation. Co-authored-by: Copilot <[email protected]>
Pipeline failed again — second defect found, fixed, and validated locallyThe first quoting commit (782bde4) did work (the Note the trailing Fix (commit 7186686)Trim a trailing directory separator (root-preserving) before quoting: // On Windows the native command-line parser treats a backslash before the closing quote as
// escaping it (e.g. "C:\dir\" becomes C:\dir"), so trim a trailing separator before quoting.
string installDir = TrimTrailingDirectorySeparators(InstallDir);
string scriptArgs = IsWindows
? $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" -Version {Version} -InstallDir \"{installDir}\""
: $"\"{scriptPath}\" --version {Version} --install-dir \"{installDir}\"";
Local validationReproduced ToolTask's exact invocation (
Root-preservation check:
|
Investigation: root cause is an agent-image update exposing latent unquoted-path bugs (not a product regression)TL;DRThe VMR Windows legs began failing because the No product source regressed — the same VMR commit passes on the old image and fails on the new one. Evidence (internal pool,
|
| Build | Finish (UTC) | Agent image | DOTNET_INSTALL_DIR |
Spaced-path failure |
|---|---|---|---|---|
| 2988460 | May 31 19:54 | 2026.0522 | …\.dotnet\ |
no |
| 2989057 | Jun 1 13:54 | 2026.0522 | …\.dotnet\ |
no (failed on IBC #6954) |
| 2992072 | Jun 4 11:31 | 2026.0522 | …\.dotnet\ |
no |
| 2992333 | Jun 4 19:35 | 2026.0522 | …\.dotnet\ |
no (Windows ✅) |
| 2992502 | Jun 4 23:41 | 2026.0522 | …\.dotnet\ |
no |
| 2992647 | Jun 5 03:07 | 2026.0529 | C:\Program Files\dotnet\ |
yes |
Mechanism
eng/common/tools.ps1 (InitializeDotNetCli):
if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) {
# picks dotnet from PATH -> C:\Program Files\dotnet
$env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent
}
# global install is then ADOPTED only if C:\Program Files\dotnet\sdk\<global.json version> existsOn image 0522 the global SDK didn't match → local .dotnet was provisioned (space-free, works). On image 0529 C:\Program Files\dotnet\sdk\10.0.300 exists → the spaced global path is adopted and propagated to every sub-repo build.
Ruled out: VMR / global.json change
global.json tools.dotnet has been 10.0.300 since May 13 (5bee494) — unchanged through the breakage.
Blast radius (latent unquoted-path bugs now firing)
- msbuild bootstrap
InstallDotNetCoreTask—-File/-InstallDirunquoted → fixed in this PR (782bde4, 7186686), validated locally. - sdk
OverlaySdkOnLKG.targets:12—<Exec Command="$(DotnetTool) --version">unquoted →C:\Program→ exit 9009 (current failure on build 1451255). - Likely additional repos that interpolate the dotnet/SDK path unquoted.
Distinct from #6954
That issue was the IBC drop.exe exit 1244 failure on the old image (~June 1, now fixed by disabling IBC). This spaced-path issue only surfaced once (a) the 0529 image arrived (~Jun 5) and (b) the IBC fix let builds progress to the bootstrap/overlay steps.
Resolution options
- Systemic (preferred): stop the VMR Windows build from reusing the spaced global SDK — e.g. pre-set
DOTNET_INSTALL_DIRto a space-free repo-local path before arcade runs, so it provisions.dotnet. One change unblocks all repos. - Per-repo hardening: quote dotnet/script paths in each affected repo (msbuild done; sdk next; possibly more). Legitimate defense-in-depth but whack-a-mole.
- Infra: ask dnceng whether the 0529 image change (pre-installing/updating SDK 10.0.300 at
C:\Program Files\dotnet) was intended, since it changes build behavior for any consumer whoseglobal.jsonmatches.
…path When the build SDK resolves to C:\Program Files\dotnet (arcade reusing the machine-wide install on the new agent image), the unquoted Exec "$(DotnetTool) --version" is parsed by cmd as C:\Program and fails with exit code 9009. Quote the path, matching dotnet/sdk main and the other $(DotNetTool) Exec calls which are already quoted. Co-authored-by: Copilot <[email protected]>
sdk hardening (commit d616390)Quoted Note: dotnet/sdk |
The build-server shutdown Exec in repo-projects/Directory.Build.targets ran the dotnet path unquoted, so with a spaced build SDK (C:\Program Files\dotnet on the new agent image) cmd parsed "C:\Program" and printed "is not recognized". IgnoreExitCode="true" masked the failure, so the compiler server was never shut down -- which then caused "process cannot access the file because it is being used by another process" warnings during CleanupRepo. Quote the path so the shutdown actually runs. Co-authored-by: Copilot <[email protected]>
Follow-up: the masked
|
|
note: agent is wrong that this is not durable, backflow will fix it in upstream repo too |
|
we also need the fix in main and 10.0.1xx etc. |
…tCoreTask Cherry-pick of the fix from #7061 (release/10.0.4xx). When the build SDK resolves to C:\Program Files\dotnet (arcade reusing the machine-wide install on the new agent image), the unquoted -File/-InstallDir args broke PowerShell parsing. Quote the script path and install dir (root-preserving trim of a trailing separator so a quoted path ending in a backslash does not escape the closing quote). Co-authored-by: Copilot <[email protected]>
…path Cherry-pick from #7061. Unquoted "$(DotnetTool) --version" failed with exit code 9009 when DotnetTool resolves to C:\Program Files\dotnet\dotnet.exe. Matches dotnet/sdk main and the other already-quoted $(DotNetTool) Exec calls. Co-authored-by: Copilot <[email protected]>
Cherry-pick from #7061. The build-server shutdown Exec ran the dotnet path unquoted; with a spaced build SDK (C:\Program Files\dotnet) cmd parsed "C:\Program" and printed "is not recognized". IgnoreExitCode="true" masked the failure, so the compiler server was never shut down, causing "file is being used by another process" errors during CleanupRepo. Quote the path. Co-authored-by: Copilot <[email protected]>
|
@JanProvaznik thanks for the fix! please port it to main as well. |
Note
This is a codeflow update. It may contain both source code changes from
the source repo
as well as dependency updates. Learn more here.
This pull request brings the following source code changes
From https://github.com/dotnet/msbuild
Diff the source with this PR branch