Repository navigation
Fix argument forwarding and stage logging in eng/build.ps1 - #14767
Merged
Merged
Conversation
The "Stage 1 build:" log line printed the internal command string, including the `$global:LASTEXITCODE = 1` prologue and the trailing `exit $LASTEXITCODE`, which is plumbing rather than something the caller can act on. Split the quoting out of Get-BuildCommand so the logged text is just the Arcade invocation. Arguments were also not reaching eng/common/build.ps1 reliably, because PowerShell binds them against this script's parameters first: - `-v minimal` bound the common `-Verbose` switch, so `minimal` arrived as a bare property and the verbosity was silently dropped. - `-b` (Arcade's `-build`) prefix-matched the local `-binaryLog` parameter, silently turning a build request into a binlog request. Declare `-verbosity` and `-build` so those arguments are claimed by the right parameter, and forward every bound parameter generically from $PSBoundParameters instead of maintaining per-parameter if-blocks. Only parameters this script reads are declared; everything else flows through $properties verbatim and is bound by Arcade, so Arcade's [bool] parameters such as -nodeReuse and -msbuildMultiThreaded keep working without needing to be mirrored here. Also give the stage 2 binary log a distinct name when -binaryLogName is supplied, instead of forwarding the same name to both stages, and stop appending an empty argument when no extra properties are passed. Co-authored-by: Copilot <[email protected]> Copilot-Session: b8bee071-e10a-4013-9ec6-d87a006fb4dd
ViktorHofer
temporarily deployed
to
copilot-pat-pool
August 20, 2026 07:03 — with
GitHub Actions
Inactive
ViktorHofer
temporarily deployed
to
copilot-pat-pool
August 20, 2026 07:03 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the eng/build.ps1 wrapper so Arcade arguments are forwarded correctly (avoiding PowerShell common-parameter/prefix binding pitfalls) and stage command logging is cleaner and more representative of the actual Arcade invocation.
Changes:
- Adds/adjusts wrapper parameters and forwards all explicitly bound parameters via
$PSBoundParameters(excluding locally handled ones) to prevent-v minimal/-bmis-binding. - Splits quoting from command construction and logs only the Arcade invocation (not
$LASTEXITCODEplumbing). - Improves binlog naming for stage 2 when
-binaryLogNameis provided, and avoids appending an empty argument when$propertiesis null.
Show a summary per file
| File | Description |
|---|---|
| eng/build.ps1 | Corrects parameter binding/forwarding, refines command logging output, and adjusts stage-2 binlog naming and argument handling. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (2)
eng/build.ps1:58
- The comment says only bound parameters are forwarded so Arcade defaults are preserved, but
-configurationis always forwarded (defaulting to Debug), which contradicts the comment and can confuse future edits. Please clarify the comment (or change behavior).
# Forward every explicitly supplied parameter to the Arcade build. Only bound parameters are forwarded,
# so parameters the caller didn't pass keep their Arcade defaults instead of being pinned to this
# script's. Parameters listed here are handled by this script and must not be forwarded verbatim.
$locallyHandledParameters = @('configuration', 'test', 'stage2', 'stage2Argument', 'binaryLogName', 'properties')
eng/build.ps1:122
- Leaving the old
if ($stage2)block commented out adds noise and makes it unclear whether stage 1 logging is intended to be conditional. Either restore the condition or remove the commented-out lines.
# if ($stage2) {
Write-Host "Stage 1 build: $(Get-BuildCommandForDisplay $buildArgs)"
# }
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
- Escape single quotes in the build script path once, in a shared $quotedBuildScript, so Get-BuildCommandForDisplay matches the escaping Get-BuildCommand already did. A repo path containing a quote otherwise rendered an invalid command line. - Clarify that -configuration is always forwarded, unlike the parameters that are only forwarded when bound. - Drop the commented-out `if ($stage2)` around the stage 1 log line. Co-authored-by: Copilot <[email protected]> Copilot-Session: b8bee071-e10a-4013-9ec6-d87a006fb4dd
AR-May
approved these changes
Aug 20, 2026
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
build.cmd -v minimalcurrently prints the wrapper's internal command string and then silently ignores the verbosity:Two separate problems are visible there: the log line leaks exit-code plumbing, and
minimalarrives as a bare property instead of-verbosity minimal.Changes
Logging. The quoting logic is split out of
Get-BuildCommand, so the logged text is just the Arcade invocation, without the$global:LASTEXITCODE = 1prologue and trailingexit $LASTEXITCODE.Argument forwarding. PowerShell binds arguments against this script's parameters before they are ever forwarded, so undeclared Arcade arguments could be swallowed or misrouted:
-v minimal-Verboseswitch;minimalleaked in as a bare property-b(Arcade's-build)-binaryLog, silently turning a build into a binlog request-verbosityand-buildare now declared so those arguments bind to the right parameter, and every bound parameter is forwarded generically from$PSBoundParametersinstead of per-parameterifblocks.Only parameters this script actually reads are declared. Everything else flows through
$propertiesverbatim and is bound by Arcade, which keeps Arcade's[bool]parameters (-nodeReuse,-msbuildMultiThreaded,-warnAsError) working without mirroring them here — mirroring them would require marshalling, sinceTrue/Falsere-parse as strings rather than booleans throughpwsh -Command.Two smaller fixes.
-binaryLogName My.binlognow yieldsMy.stage2.binlogfor stage 2 rather than forwarding one name to both stages, and an empty argument is no longer appended when no extra properties are passed.Testing
-ci -test -stage2Argument /mt,-ci -test -stage2Argument '/p:RunQuarantinedTests=true')./p:Foo=Bar,-warnnotaserror 'NU1901;NU1902',-mt 1,-nodeReuse 0,-sign -pack -publish,-pb -projects.build.cmd -v quiet: build succeeded and the verbosity took effect.