Skip to content

[dotnet] Fix CoreCLR framework signing with correct Info.plist tracking. Fixes #25248.#25254

Merged
rolfbjarne merged 3 commits intonet11.0from
dev/rolf/issue-25248-fw-identity
Apr 30, 2026
Merged

[dotnet] Fix CoreCLR framework signing with correct Info.plist tracking. Fixes #25248.#25254
rolfbjarne merged 3 commits intonet11.0from
dev/rolf/issue-25248-fw-identity

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

Summary

Fix incremental-build bugs that could cause CoreCLR framework bundles (converted from dylibs) to be missing or have stale Info.plist files, leading to codesign signing them as bare Mach-O binaries instead of framework bundles. This results in a mismatched bundle ID / signing identifier, which causes iOS device installs to fail with MismatchedBundleIDSigningIdentifier.

Changes

MSBuild targets fixes (Microsoft.Sdk.R2R.targets)

  1. Fixed _CreateInfoPlistForFrameworks Inputs: Changed from using the hash string ($(_ComputeFrameworksToCreateAppManifestHashedInputs)) to the hash file path ($(_ComputeFrameworksToCreateAppManifestHashedInputsPath)). The hash string is computed at evaluation time and always changes, defeating incremental build skipping.

  2. Added $(_BundleIdentifier) to hash inputs: The bundle identifier flows into the generated Info.plist's CFBundleIdentifier, so changes to it must trigger regeneration.

MSBuild targets fixes (Xamarin.Shared.Sdk.targets)

  1. Added Info.plist tracking to _CopyDirectoriesToBundle: The target's Inputs only tracked framework binary timestamps (via _DirectoriesToPublish), not their Info.plist files. If the Info.plist was regenerated but the binary wasn't, the copy step would be skipped and the app bundle would have a stale or missing Info.plist.

Unit test (PostBuildTest.cs)

Added CoreCLR_ConvertedFrameworks_HaveInfoPlist test (iOS + tvOS) that verifies:

  • Every .framework directory contains an Info.plist
  • CFBundleIdentifier starts with the app's bundle identifier
  • CFBundleExecutable and CFBundlePackageType are correct
  • Codesign identifies the framework as a bundle (not bare Mach-O)
  • Codesign identifier matches the Info.plist CFBundleIdentifier

Fixes #25248

🤖 Pull request created by Copilot

rolfbjarne and others added 2 commits April 27, 2026 17:30
…ist tracking. Fixes #25248.

Fix three issues with the dylib-to-framework conversion for CoreCLR iOS/tvOS
device builds:

1. _CreateInfoPlistForFrameworks used the hash string value instead of the hash
   file path in its Inputs, making the target always appear out-of-date.

2. _CopyDirectoriesToBundle only tracked the framework binary timestamp in its
   Inputs, not the Info.plist. If the Info.plist changed (e.g., bundle ID
   change) but the binary didn't, the copy was skipped and the app bundle
   could have a stale or missing Info.plist.

3. The bundle identifier ($(_BundleIdentifier)) was not included in the hash
   inputs for _ComputeFrameworksToCreate, so changing ApplicationId would not
   trigger Info.plist regeneration for converted frameworks.

These issues could result in framework bundles being signed without a valid
Info.plist, causing codesign to treat them as bare Mach-O files instead of
framework bundles. iOS then rejects the app at install time with
MismatchedBundleIDSigningIdentifier.

Fixes #25248

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The R2R framework uses '<bundleid>.r2rframework' as its CFBundleIdentifier,
not '<bundleid>.<frameworkname>'. Update the test to verify the identifier
starts with the app bundle identifier prefix rather than matching an exact
pattern, and check that codesign uses the same identifier as the Info.plist.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review April 28, 2026 09:15
Copilot AI review requested due to automatic review settings April 28, 2026 09:15
Copy link
Copy Markdown
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

Fixes incremental-build issues that could leave converted CoreCLR dylib frameworks with missing/stale Info.plist, causing codesign to sign them as bare Mach-O binaries and resulting in device install failures (MismatchedBundleIDSigningIdentifier).

Changes:

  • Fix _CreateInfoPlistForFrameworks incremental inputs by tracking a hash file (not a hash string) and including the bundle identifier in the hashed inputs.
  • Attempt to make _CopyDirectoriesToBundle rerun when framework Info.plist changes by adding additional Inputs.
  • Add a unit test validating that bundled .framework directories contain a correct Info.plist and (when signed) have matching codesign identifiers.

Reviewed changes

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

File Description
dotnet/targets/Microsoft.Sdk.R2R.targets Improves incremental build correctness for generating framework Info.plist by tracking stable inputs.
dotnet/targets/Xamarin.Shared.Sdk.targets Extends copy target Inputs to include Info.plist changes (but current implementation appears ineffective; see comments).
tests/dotnet/UnitTests/PostBuildTest.cs Adds a regression test for CoreCLR-converted frameworks’ Info.plist and signing behavior.

Comment thread tests/dotnet/UnitTests/PostBuildTest.cs Outdated
Comment thread dotnet/targets/Xamarin.Shared.Sdk.targets Outdated
Comment thread tests/dotnet/UnitTests/PostBuildTest.cs
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

- Fix _DirectoriesToPublishInfoPlist to derive Info.plist path from
  SourceDirectory metadata instead of non-existent AppManifestPath metadata.
- Remove null-forgiving operators in test, use proper Assert.That assertions.
- Assert codesign exit code to avoid unused variable warning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #182ce4b] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 161 tests passed 🎉

Tests counts

✅ 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 9 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 15 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: 182ce4b6a3b3ea194a798f315160c4581ebc6e6e [PR build]

@rolfbjarne rolfbjarne enabled auto-merge (squash) April 30, 2026 09:41
Copy link
Copy Markdown
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

copilot is msbuilding! 🤖

@rolfbjarne rolfbjarne merged commit da4db66 into net11.0 Apr 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants