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 9491 [details]
Diagnostic build output
Incremental Build setting causes Unified app crash during launch: "Library not loaded ... libmonosgen-2.0.dylib"
The symptoms of this bug are superficially quite similar to bug 23526, but the underlying cause is different. In this case code signing is not the problem because the problem occurs on iOS 7 and iOS 7 does not require codesigned `.dylib` files. Instead the problem is that the build process for Unified API projects does not copy `libmonosgen-2.0.dylib` into the app bundle _at all_.
The results are the same when building via Visual Studio or when building via `xbuild` (or Xamarin Studio) on Mac.
## Regression status: new feature: Unified API
## Steps to reproduce (example for Visual Studio)
1. Create a new "Visual C# -> iOS -> iPhone -> Single View App (iPhone)" app. This will be a Unified API app.
2. Set the Unified Devices menu to select a hardware device connected to the Mac build host.
3. Enable "iOS Build -> General -> Debugging options -> Enable incremental builds" (MtouchFastDev) and save the project properties.
4. Set "iOS Application -> Deployment Target" to "7.0".
5. Attempt to build and run the project on an iOS 7 device.
## Results: the app crashes during launch
From Xcode -> Window -> Devices -> "Device Name" -> View Device Logs [button]
> Dyld Error Message:
> Library not loaded: @executable_path/libmonosgen-2.0.dylib
> Referenced from: /var/mobile/Applications/D3E2A463-FF71-451B-B159-1526BF155E10/SingleViewUnified.app/SingleViewUnified
> Reason: image not found
> Dyld Version: 324.1
## Results: missing `.dylib` files
The `.app` bundle does not contain all of the expected `.dylib` files
### Unified API app `.dylib` files
> $ (cd UnifiedSingleViewiPhone1.app; ls *.dylib)
### Classic API app `.dylib` files
> $ (cd ClassicSingleViewiPhone1.app; ls *.dylib)
Note: the default Classic API template uses the Boehm GC, but switching to sgen works too. When sgen is enabled the Classic API app bundle will contain `libmonosgen-2.0.dylib` as expected.
### Windows 8.1 64-bit, in VMWare Fusion 6.0.5 (2209127)
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Xamarin 3.9.274.0 (74260cb)
Xamarin.Android 220.127.116.11 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS 18.104.22.168 (dd1b996f9fab5be032c5bfc54df1bc445953e90f)
### OS X 10.9.5, MacBook Air
Xcode 6.1 (6604), Build 6A1052d
Version: 22.214.171.124 (Business Edition), Hash: 80971a6
Build date: 2015-01-21 17:42:51-0500
Xamarin Studio Version 5.7 (build 661), Hash: b70bab61d
Build date: 2015-01-05 16:31:31-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7
Mono 3.12.0 ((detached/a813491)
Xamarin.iOS 126.96.36.199 (Business Edition), Hash: dfb682f
Build date: 2015-01-08 13:39:32-0500
The easiest workaround is simply to disable the incremental build setting.
## Alternate workaround
I'll also mention another workaround because it makes it clear that the missing `libmonosgen-2.0.dylib` really is the main problem:
1. Build a Classic API project for device using the incremental build feature.
2. Copy the `libmonosgen-2.0.dylib` file from the completed Classic API app into the Unified API project, and set its build action to "Content".
The app will now launch successfully on iOS 7 devices. It will still fail on iOS 8 devices (bug 26405).
This only happens for 32+64bit apps, selecting either ARM64 or ARMv7[s] as the architecture is another workaround.
In any case we already fixed this internally:
QA: unit tests were added as well.