Skip to content

[dotnet] Report a clear error for PublishReadyToRunComposite=false. Fixes #26456. - #26475

Open
rolfbjarne wants to merge 1 commit into
net11.0from
dev/rolf/issue-26456
Open

[dotnet] Report a clear error for PublishReadyToRunComposite=false. Fixes #26456.#26475
rolfbjarne wants to merge 1 commit into
net11.0from
dev/rolf/issue-26456

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Setting PublishReadyToRunComposite=false made the build fail with one
MSB3030: Could not copy the file ".../R2R/<Assembly>.dylib" because it was not found. error per assembly, which gives no clue about what's actually wrong.

Non-composite ReadyToRun compilation just isn't supported with the Mach-O
container format we use for iOS, tvOS and Mac Catalyst:

So report a single, actionable error instead.

Fixes #26456

🤖 Pull request created by Copilot

…ixes #26456.

Setting `PublishReadyToRunComposite=false` made the build fail with one
`MSB3030: Could not copy the file ".../R2R/<Assembly>.dylib" because it was not
found.` error per assembly, which gives no clue about what's actually wrong.

Non-composite ReadyToRun compilation just isn't supported with the Mach-O
container format we use for iOS, tvOS and Mac Catalyst:

* crossgen2 emits one Mach-O object file per assembly, but no component
  assemblies for the runtime to load, and the SDK replaces the IL assemblies in
  the publish output with the (never created) per-assembly dylibs.
* The runtime only knows how to locate platform-native ReadyToRun code by
  looking up the owner composite image, see
  https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/botr/readytorun-platform-native-envelope.md

So report a single, actionable error instead.

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 the developer experience when PublishReadyToRunComposite=false is set for Apple-platform app bundles using the Mach-O ReadyToRun container format, by failing fast with a single actionable MSBuild error instead of many per-assembly MSB3030 copy failures. It also adds a regression test and documents the property behavior.

Changes:

  • Add an MSBuild validation target that emits one clear error when non-composite R2R is requested with PublishReadyToRunContainerFormat=macho for app bundles.
  • Add a unit test asserting the build fails with exactly one, actionable error for iOS/tvOS/Mac Catalyst.
  • Document PublishReadyToRunComposite behavior and the platform limitation in build properties docs.

Reviewed changes

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

File Description
tests/dotnet/UnitTests/ProjectTest.cs Adds a regression test ensuring PublishReadyToRunComposite=false yields a single clear failure.
dotnet/targets/Microsoft.Sdk.R2R.targets Adds _ValidateReadyToRunComposite to fail fast with an actionable MSBuild error before R2R compilation prep.
docs/building-apps/build-properties.md Documents PublishReadyToRunComposite and calls out unsupported non-composite R2R for relevant Apple app bundles.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/building-apps/build-properties.md
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: db27052f282e888fc71791fc97876f71e2f56aa4 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #db27052] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 260 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 24 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 24 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 24 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: db27052f282e888fc71791fc97876f71e2f56aa4 [PR build]

@rolfbjarne
rolfbjarne enabled auto-merge (squash) August 28, 2026 08:55
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[net11] PublishReadyToRunComposite=false fails to build on iOS with MSB3030 for every assembly

3 participants