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 13997 [details]
Exception with stack trace pasted below thrown when building with "Link framework SDKs only" when using CouchBase.Lite and getting an instance of the Database. Downgrading to XI 188.8.131.52 resolves the issue.
# Steps to reproduce
1. Open the attached test project in Xamarin Studio (Mac)
2. Ensure that linker option is set to "Link framework SDKs only"
3. Deploy app to device or simulator.
Expected behavior: No exception thrown.
Actual behavior: System.TypeInitializationException is thrown (it is caught and written to the console) with the following stack trace
>System.TypeInitializationException: The type initializer for 'Couchbase.Lite.Util.Log' threw an exception. ---> System.NotSupportedException: Linked Away
> at System.Security.Permissions.SecurityPermission..ctor (SecurityPermissionFlag ) [0x00005] in <filename unknown>:0
> at System.Diagnostics.Trace.get_Listeners () [0x00000] in /Users/builder/data/lanes/2356/3c0ec355/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/System/compmod/system/diagnostics/Trace.cs:34
> at Couchbase.Lite.Util.CustomLogger..ctor (SourceLevels logLevel) [0x00024] in /Users/borrrden/Development/couchbase-lite-net/src/Couchbase.Lite.Shared/Util/CustomLogger.cs:67
> at Couchbase.Lite.Util.LoggerFactory.CreateLogger () [0x00000] in /Users/borrrden/Development/couchbase-lite-net/src/Couchbase.Lite.Shared/Util/LoggerFactory.cs:57
> at Couchbase.Lite.Util.Log..cctor () [0x00000] in /Users/borrrden/Development/couchbase-lite-net/src/Couchbase.Lite.Shared/Util/Log.cs:55
> --- End of inner exception stack trace ---
> at Couchbase.Lite.Manager..ctor (System.IO.DirectoryInfo directoryFile, Couchbase.Lite.ManagerOptions options) [0x00006] in /Users/borrrden/Development/couchbase-lite-net/src/Couchbase.Lite.Shared/Manager.cs:199
> at Couchbase.Lite.Manager.get_SharedInstance () [0x00000] in /Users/borrrden/Development/couchbase-lite-net/src/Couchbase.Lite.Shared/Manager.cs:111
> at cbtest.AppDelegate.FinishedLaunching (UIKit.UIApplication application, Foundation.NSDictionary launchOptions) [0x00003] in /Users/apple/Downloads/cbtest/cbtest/AppDelegate.cs:27
# Supplemental info (logs, images, videos)
Diagnostic build output attached.
# Test environment (full version information)
Version 5.10 (build 871)
Installation UUID: 85e6ee18-f90f-4874-b31d-d68d4013265e
Mono 4.2.1 (explicit/6dd2d0d)
GTK+ 2.24.23 (Raleigh theme)
Package version: 402010102
Apple Developer Tools
Xcode 7.1.1 (9081)
Version: 184.108.40.206 (Business Edition)
Build date: 2015-11-12 13:05:39-0500
Version: 220.127.116.11 (Business Edition)
Android SDK: /Users/khai/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.4 (API level 19)
5.0 (API level 21)
6.0 (API level 23)
SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.0
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Xamarin Android Player
Location: /Applications/Xamarin Android Player.app
Version: 18.104.22.168 (Starter Edition)
Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 06:02:54-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-lion-cycle6
Mac OS X 10.11.1
Darwin iMac.local 15.0.0 Darwin Kernel Version 15.0.0
Sat Sep 19 15:53:46 PDT 2015
*** Bug 36177 has been marked as a duplicate of this bug. ***
The linker did not change but the BCL (mono) did - and include the code that triggers this.
* Add `-nolinkaway` to the "Additional mtouch arguments" of the project's option
* Larger application size (after linking)
Is the fix for the issue available on the latest Xamarin Stable Channel? I'm using Xamarin.iOS 22.214.171.124 and Xamarin Studio 126.96.36.199 (Build 3) and I'm still seeing this isssue.
@Tuan, no the fix requires several changes across repos and will require more testing before reaching stable. The workaround should (from comment #5) should work for you with only a small impact on the final code size.
Any ETA or estimate timeframe on when the fix will be available in stable? Using "Don't Link" actually increased on app size quite bit (20+ MB) and will definitely exceed the 100 MB cellular download limit.
@tuan, are you using "Don't Link" or just adding `-nolinkaway` under the "Additional mtouch argument"?
Those 2 options are different. As I understand it, `-nolinkaway` only changes a small subset of `mscorlib.dll`. "Don't Link" turns off linking for _all_ assemblies.
I'm using "Don't Link" as the linking behavior. I will try using the mtouch argument solution.
@Brendan Zagaeski thanks for pointing out the difference. Using the mtouch argument "-nolinkaway" only added a couple MB to the app size.