Skip to content

Add Rosetta diagnostics to Apple Helix device jobs#125897

Draft
vitek-karas wants to merge 2 commits intodotnet:mainfrom
vitek-karas:copilot/rosetta-diagnostics-ioslike
Draft

Add Rosetta diagnostics to Apple Helix device jobs#125897
vitek-karas wants to merge 2 commits intodotnet:mainfrom
vitek-karas:copilot/rosetta-diagnostics-ioslike

Conversation

@vitek-karas
Copy link
Member

Note

This PR description was AI/Copilot-generated.

Summary

  • log Rosetta state before Apple device Helix workitems invoke the x64 dotnet-cli
  • scope a single ios_arm64 AllSubsets_CoreCLR job to the dedicated runtime-ioslike pipeline so the diagnostics can be exercised on a PR
  • leave default PR validation unchanged

Why

Issue #125826 points to Apple device hosts failing before app build with Bad CPU type in executable. This PR makes the workitem log:

  • pkgutil Rosetta receipt state
  • Rosetta runtime file presence
  • arch -x86_64 success/failure
  • DOTNET_ROOT and file output for the Helix dotnet host
  • sysctl.proc_translated when available

Validation

  • baseline build on main: ./build.sh clr+libs -lc release -rc checked
  • XML well-formedness check for eng/testing/tests.ioslike.targets
  • YAML parse check for eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
  • shell syntax check for the Rosetta diagnostic snippet
  • git diff --check

CI / How to run

  • Default PR CI does not run the affected Apple device jobs.
  • To exercise this change on the PR, comment:
    • /azp run runtime-ioslike

Log Rosetta installation and x64 execution checks before Apple device Helix workitems invoke the x64 dotnet-cli, and scope a single ios_arm64 AllSubsets_CoreCLR job to the manual runtime-ioslike pipeline so the diagnostics can be exercised on a PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 21, 2026 22:02
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @akoeplinger, @matouskozak, @simonrozsival
See info in area-owners.md if you want to be subscribed.

@vitek-karas
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Rosetta/environment diagnostics to Apple device Helix workitems to help diagnose intermittent Bad CPU type in executable failures when the x64 dotnet-cli is invoked on arm64 hosts, and scopes a single ios_arm64 job to the dedicated runtime-ioslike pipeline so the diagnostics can be exercised on PRs without changing default PR validation.

Changes:

  • Emit a Rosetta diagnostics shell snippet before running the Helix dotnet msbuild publish step for iOS/tvOS device workitems.
  • Scope AllSubsets_CoreCLR to run on ios_arm64 only when isiOSLikeOnlyBuild is enabled (for the runtime-ioslike pipeline).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
eng/testing/tests.ioslike.targets Builds a Rosetta diagnostics command and injects it into the Helix AOT build command chain.
eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml Conditionally enables ios_arm64 for the CoreCLR libraries Helix job when running the dedicated iOS-like pipeline.

Comment on lines +18 to +22
<_RosettaDiagnosticsCommand Condition="'$(_RosettaDiagnosticsCommand)' != ''">$(_RosettaDiagnosticsCommand) if /usr/bin/arch -x86_64 /usr/bin/true &gt;/dev/null 2&gt;&amp;1; then echo "x64_exec_works=true"; else echo "x64_exec_works=false"; fi; echo "DOTNET_ROOT=$DOTNET_ROOT"; </_RosettaDiagnosticsCommand>
<_RosettaDiagnosticsCommand Condition="'$(_RosettaDiagnosticsCommand)' != ''">$(_RosettaDiagnosticsCommand) if [ -n "$DOTNET_ROOT" ] &amp;&amp; [ -e "$DOTNET_ROOT/dotnet" ]; then echo "dotnet_host=$DOTNET_ROOT/dotnet"; /usr/bin/file "$DOTNET_ROOT/dotnet" || true; else echo "dotnet_host=missing"; fi; echo "=== End Rosetta diagnostics ==="; </_RosettaDiagnosticsCommand>

<_AOTBuildCommand>export PATH=$HELIX_CORRELATION_PAYLOAD/build/cmake/cmake-3.28.0-macos-universal/CMake.app/Contents/bin:$PATH &amp;&amp; </_AOTBuildCommand>
<_AOTBuildCommand Condition="'$(_RosettaDiagnosticsCommand)' != ''">$(_AOTBuildCommand) $(_RosettaDiagnosticsCommand) &amp;&amp; </_AOTBuildCommand>
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assembled shell command can become syntactically invalid: _RosettaDiagnosticsCommand ends its last statement with a trailing ; (and earlier fragments also end with ;), but _AOTBuildCommand appends && after the diagnostics. That produces ...; && dotnet msbuild ..., which sh treats as a syntax error and will fail the workitem before the build.

Consider removing the trailing ; from the final diagnostics fragment (and/or ensure the diagnostics string ends with a real command like true), or avoid appending && after the diagnostics and instead have the diagnostics expression itself return success in a way that composes cleanly with &&.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vitek-karas
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants