Repository navigation
[ci] Avoid macOS PowerShell startup failures - #13709
Conversation
Set __PWSH_LOGIN_CHECKED for CI tasks to skip the PowerShell login-shell check, following the MAUI workaround for intermittent procargs errno 5 failures on macOS. Context: #12652 Context: dotnet/maui#35724 Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the shared Android CI PowerShell startup workaround.
No open issues 🎉
What changed in this PR
This PR updates shared .NET for Android CI configuration to avoid intermittent macOS PowerShell startup failures caused by procargs errors.
Changes:
- Sets
__PWSH_LOGIN_CHECKED='1'so PowerShell task processes skip the failing login-shell check. - Adds comments linking the Android issue and the equivalent MAUI workaround.
| File | Description |
|---|---|
build-tools/automation/yaml-templates/variables.yaml |
Adds the shared PowerShell startup workaround and context links. |
Review effort: Balanced
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
Verdict: no blocking code findings; independent Azure CI verification is incomplete.
Reviewed the complete changed file and its pipeline consumers before reconciling the PR description. The shared variable template is included by the public, internal, nightly, and API-docs pipelines. The exact variable name and quoted value match dotnet/maui#35724, and PowerShell's AttemptExecPwshLogin() checks this marker before the macOS sysctl calls, clears it, and returns. This is a narrowly scoped workaround that avoids changing individual task definitions or product behavior.
Findings: 0 errors, 0 warnings, 1 non-blocking documentation suggestion, posted inline.
CI: All 39 returned GitHub checks completed successfully, including the aggregate dotnet-android check for Azure build 1693921 and the macOS lanes. The standalone Azure build-status query was rejected because the CLI requires authentication, so I could not independently confirm Azure's build result or timeline. No local macOS reproduction was performed in this Linux review environment; the PR's reported fault-injection results were not independently rerun.
Generated by Android PR Reviewer for #13709 · copilot · gpt61 · 21 AIC · ⌖ 7.5 AIC · ⊞ 20.3K
Comment /review to run again
| value: 'TestCategory!=SystemApplication&TestCategory!=TimeZoneInfo&TestCategory!=Localization' | ||
| - name: RunMAUITestJob | ||
| value: true | ||
| # Avoid macOS PowerShell startup failures: https://github.com/dotnet/android/issues/12652 |
There was a problem hiding this comment.
🤖 💡 Documentation — Consider adding the upstream PowerShell/PowerShell#20802 link and a short note that PowerShell clears this marker during startup. AttemptExecPwshLogin() removes it before returning, so this protects each task's initial PowerShell process, not nested pwsh processes unless they set it again. The PR description explains that limitation well; keeping it beside the workaround would preserve it for future pipeline changes.
{Rule: Comments explain why; document behavioral limitations}
Context: #12652
Context: dotnet/maui#35724
Context: PowerShell/PowerShell#20802
PowerShell intermittently exits before running CI scripts on macOS with
Call to 'procargs' failed with errno 5. Its login-shell detection treats a failedsysctlcall as a fatal startup error, causing unrelated pipeline steps to fail.Set
__PWSH_LOGIN_CHECKED=1in the shared CI variables, following MAUI's workaround, to skip the login-shell check for PowerShell task processes. PowerShell consumes this internal variable at startup, so nested PowerShell processes are not protected unless it is set again.Validation:
ruby -e 'require "yaml"; d = YAML.load_file(ARGV[0]); v = d.fetch("variables").select { |x| x["name"] == "__PWSH_LOGIN_CHECKED" }; abort "incorrect variable" unless v == [{"name" => "__PWSH_LOGIN_CHECKED", "value" => "1"}]; puts "PASS: YAML parses and sets __PWSH_LOGIN_CHECKED to 1"' build-tools/automation/yaml-templates/variables.yaml— passed.sysctlfault injector compiled to$work/interpose.dylib,env -u __PWSH_LOGIN_CHECKED DYLD_INSERT_LIBRARIES="$work/interpose.dylib" SYSCTL_INJECT_PROCARGS_ERRNO=5 pwsh -NoLogo -NoProfile -NonInteractive -Command 'Write-Output STARTED'reproduced the startup failure;env __PWSH_LOGIN_CHECKED=1 DYLD_INSERT_LIBRARIES="$work/interpose.dylib" SYSCTL_INJECT_PROCARGS_ERRNO=5 pwsh -NoLogo -NoProfile -NonInteractive -Command 'Write-Output STARTED'succeeded.git diff --check— passed.The full Azure Pipelines run was not executed locally.