Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 9261 [details]
The mdtool build process does not automatically codesign .dylib files that it copies into the app bundle. The new MSBuild tasks _do_ automatically codesign these files.
Admittedly this might be a known limitation of the old mdtool build process with no plans for a fix. If I'm not mistaken, .dylib usage in iOS apps has only been permitted on the App Store starting with iOS 8. So it's possible that updating the mdtool build process to handle this scenario might be unnecessary, especially considering that enabling the MSBuild build engine is an effective workaround (at least for the attached test project). In short, feel free to mark the bug as RESOLVED INVALID (or similar) if appropriate.
Regression status: not a regression.
## Steps to reproduce
Build the "iOSFooAppClassic" project from the attached test case in Xamarin Studio on Mac and run it on a physical device.
## Test case
The test app is a simple template project with a few lines added to P/Invoke a native method from the `Foo.dylib` library.
The project has "MONO_LOG_LEVEL=debug" set under "Project Options -> Run -> General -> Environment Variables" to enable more verbose information from DllImport.
The app crashes because `Foo.dylib` was not signed during the build process.
### Error at run time
> DllImport error loading library 'Foo.dylib': 'dlopen(Foo.dylib, 9): no suitable image found. Did find:
> Foo.dylib: code signature invalid for 'Foo.dylib'
... and a little later:
> Unhandled managed exception: Foo.dylib (System.DllNotFoundException)
### Related "Build Output"
> Signing application
> codesign -v -f -s "123AB1A1A1234A12A123A123AA1A12A1234567A1"
> --entitlements "/Users/macuser/Projects/iOSDylibSigning/iOSFooAppClassic/bin/iPhone/Debug/iOSFooAppClassic.xcent"
> /Users/macuser/Projects/iOSDylibSigning/iOSFooAppClassic/bin/iPhone/Debug/iOSFooAppClassic.app: replacing existing signature
> /Users/macuser/Projects/iOSDylibSigning/iOSFooAppClassic/bin/iPhone/Debug/iOSFooAppClassic.app: signed bundle with Mach-O thin (armv7) [com.your-company.iOSFooAppClassic]
## Additional results / "workarounds"
- The "iOSFooApp" (Unified) project _does_ sign `Foo.dylib`, and the app runs successfully.
- Enabling "Project Options -> Build -> General -> Use MSBuild build engine" stops the problem for the "iOSFooAppClassic" project.
- Both the "iOSFooApp" project and the "iOSFooAppClassic" project build and run successfully when compiled via Visual Studio on Windows.
- Manually signing `Foo.dylib` with the same signing identity that Xamarin Studio uses for the .app bundle is sufficient to stop the problem.
## Version information
Mac OS X 10.9.5
=== Xamarin Studio ===
Version 5.7 (build 660)
Installation UUID: 2c0ea975-8f73-4920-8414-3e9ae359fbf4
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
=== Apple Developer Tools ===
Xcode 6.1 (6604)
=== Xamarin.iOS ===
Version: 184.108.40.206 (Business Edition)
Build date: 2015-01-06 14:27:58-0500
=== Build Information ===
Release ID: 507000660
Git revision: 6a74f9bdb90d9415b597064d815c9be38b401fee
Build date: 2014-12-18 00:38:00-05
Xamarin addins: 57be0f5e1433cb58b70ea9b52e9dc77ad791be40
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Xamarin 220.127.116.11 (23e2325)
Xamarin.Android 18.104.22.168 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS 22.214.171.124 (cb9aa8428c4d41de5ee53797a6f05cacb43bc32c)
*** This bug has been marked as a duplicate of bug 23526 ***