Couchbase Lite .NET 1.1.2 crashes with latest Xamarin iOS 9.2.1.51

I upgraded to the latest Xamarin iOS update and now my app crashes on Couchbase initialization.

The code crashes when calling Manager.Instance with the following exception. It appears to be some sort of SecurityPermission issue with the logger. Anyone know of a solution or workaround? I’ve submitted bugs to both Xamarin and couchbase-lite-net (Database crash on initialization calling Manager.Instance using Xamarin iOS 9.2.1.51 · Issue #529 · couchbase/couchbase-lite-net · GitHub)

CBTestApp[844:223812] The type initializer for ‘Couchbase.Lite.Util.Log’ threw an exception.
CBTestApp[844:223812] 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 CBTestApp.ViewController.ViewDidLoad () [0x00008] in /Users/phamt/Projects/CBTestApp/ViewController.cs:24
CBTestApp[844:223812] Linked Away
CBTestApp[844:223812] at System.Security.Permissions.SecurityPermission…ctor (SecurityPermissionFlag ) <0x2e9b60 + 0x0001c> in :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

It appears to be a Xamarin Linker configuration issue so far. Changing the build configuration to “Don’t Link” appears to fix the issue. Crash will occur if linker behavior is “Link All” or “Link Framework SDKs Only”.

I experience the same problem. The issue here is that in “Release” mode for ah-hoc or app-store distribution, “Don’t Link” is not an option :frowning:

Also have been bug in previous releases: https://bugzilla.xamarin.com/show_bug.cgi?id=1144

Here’s the xamarin bug submitted for this issue: https://bugzilla.xamarin.com/show_bug.cgi?id=36177

Just to confirm that this works well if we downgrade Xamarin iOS to version 9.1.0.31. Also, on the iOS Simulator it works well. The problem only happened to me on the devices.