[dotnet] Report a clear error for PublishReadyToRunComposite=false. Fixes #26456. - #26475
[dotnet] Report a clear error for PublishReadyToRunComposite=false. Fixes #26456.#26475rolfbjarne wants to merge 1 commit into
Conversation
…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.
There was a problem hiding this comment.
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=machofor app bundles. - Add a unit test asserting the build fails with exactly one, actionable error for iOS/tvOS/Mac Catalyst.
- Document
PublishReadyToRunCompositebehavior 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.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🚀 [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 macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Setting
PublishReadyToRunComposite=falsemade the build fail with oneMSB3030: 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:
assemblies for the runtime to load, and the SDK replaces the IL assemblies in
the publish output with the (never created) per-assembly dylibs.
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.
Fixes #26456
🤖 Pull request created by Copilot