Xamarin Forms app crashes when replication started on Android

#1

I have a small test app that I use to test various aspects of Couchbase Lite and sync’ing with a Couchbase server. It simply shows the number of documents grouped by type - and updates the view if the replication adds/removes any documents.

I’ve just recently upgraded my mobile dev. environment to VisualStudio 2019, Xamarin Forms 3.6, Couchbase Lite 2.5, and Android 9.

The code is running fine in iOS Simulator and on physical iPhone. However, on Android (emulator or device) the app now crashes when I start replication:

[Mono] Loading reference 4 of /storage/emulated/0/Android/data/dk.dalsgaard_data.xamarin.Couchbase/files/.__override__/cb2.dll asmctx DEFAULT, looking for Couchbase.Lite, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null
[Mono] Assembly Ref addref cb2[0x7d1cc98500] -> Couchbase.Lite[0x7d1cc98600]: 3
[Mono] Loading reference 3 of /storage/emulated/0/Android/data/dk.dalsgaard_data.xamarin.Couchbase/files/.__override__/Xamarin.Android.Support.Core.UI.dll asmctx DEFAULT, looking for Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[Mono] Assembly Ref addref Xamarin.Android.Support.Core.UI[0x7d1cd83c00] -> Xamarin.Android.Support.Compat[0x7d1cd83a00]: 5
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_set_int_field'.
[Mono] Probing 'java_interop_jnienv_set_int_field'.
[Mono] Found as 'java_interop_jnienv_set_int_field'.
Instantiate cb2.Services.DbDataStore
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4_getVersion'.
[Mono] Probing 'c4_getVersion'.
[Mono] Found as 'c4_getVersion'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLSliceResult_Release'.
[Mono] Probing 'FLSliceResult_Release'.
[Mono] Found as 'FLSliceResult_Release'.
[CouchbaseLite] [1]| [Database] (Startup) [1] CouchbaseLite/2.5.0 (.NET; Android 8.1.0 [API 27]; LGE Nexus 5X) Build/190 LiteCore/09e4c055573721d63a5e0cf1405d273a18072f11 (1782) Commit/0080df3
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4log_binaryFileLevel'.
[Mono] Probing 'c4log_binaryFileLevel'.
[Mono] Found as 'c4log_binaryFileLevel'.
Thread started: <Thread Pool> #2
Thread started: <Thread Pool> #3
Thread started: <Thread Pool> #4
Thread started: <Thread Pool> #5
Loaded assembly: Anonymously Hosted DynamicMethods Assembly [External]
[CouchbaseLite] [1]| [Database] (Logging) [1] Database.Log.File.Config is null, meaning file logging is disabled.  Log files required for product support are not being generated.
[CouchbaseLite] [1]| [Database] (Database) [1] Opening database at /data/user/0/dk.dalsgaard_data.xamarin.Couchbase/files/fangst.cblite2
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4db_open'.
[Mono] Probing 'c4db_open'.
[Mono] Found as 'c4db_open'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4log_getDomainName'.
[Mono] Probing 'c4log_getDomainName'.
[Mono] Found as 'c4log_getDomainName'.
[CouchbaseLite] [1]| [Database] {N8litecore8DataFile6SharedE#1}==> N8litecore8DataFile6SharedE 0x7d0a390610 @0x7d0a390610
[CouchbaseLite] [1]| [Database] {N8litecore8DataFile6SharedE#1} instantiated on /data/data/dk.dalsgaard_data.xamarin.Couchbase/files/fangst.cblite2/db.sqlite3
[CouchbaseLite] [1]| [Database] {DB#2}==> N8litecore14SQLiteDataFileE /data/user/0/dk.dalsgaard_data.xamarin.Couchbase/files/fangst.cblite2/db.sqlite3 @0x7d0951b960
[CouchbaseLite] [1]| [Database] {DB#2} Opening database
Thread started:  #6
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4db_getDocumentCount'.
[Mono] Probing 'c4db_getDocumentCount'.
[Mono] Found as 'c4db_getDocumentCount'.
Database 'fangst' created
Log in with user: anonymous
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4socket_registerFactory'.
[Mono] Probing 'c4socket_registerFactory'.
[Mono] Found as 'c4socket_registerFactory'.
Try to start the replicator...
[CouchbaseLite] [1]| [Replicator] (Replicator) [1] Replicator[<*> ws://ds9.dalsgaard-data.dk:4984/data]: Starting
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_New'.
[Mono] Probing 'FLEncoder_New'.
[Mono] Found as 'FLEncoder_New'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_BeginDict'.
[Mono] Probing 'FLEncoder_BeginDict'.
[Mono] Found as 'FLEncoder_BeginDict'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_WriteKey'.
[Mono] Probing 'FLEncoder_WriteKey'.
[Mono] Found as 'FLEncoder_WriteKey'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_WriteString'.
[Mono] Probing 'FLEncoder_WriteString'.
[Mono] Found as 'FLEncoder_WriteString'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_EndDict'.
[Mono] Probing 'FLEncoder_EndDict'.
[Mono] Found as 'FLEncoder_EndDict'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_WriteBool'.
[Mono] Probing 'FLEncoder_WriteBool'.
[Mono] Found as 'FLEncoder_WriteBool'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_WriteInt'.
[Mono] Probing 'FLEncoder_WriteInt'.
[Mono] Found as 'FLEncoder_WriteInt'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_Finish'.
[Mono] Probing 'FLEncoder_Finish'.
[Mono] Found as 'FLEncoder_Finish'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLEncoder_Free'.
[Mono] Probing 'FLEncoder_Free'.
[Mono] Found as 'FLEncoder_Free'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4repl_new'.
[Mono] Probing 'c4repl_new'.
[Mono] Found as 'c4repl_new'.
Thread started:  #7
[CouchbaseLite] [1]| [Database] {DB#3}==> N8litecore14SQLiteDataFileE /data/user/0/dk.dalsgaard_data.xamarin.Couchbase/files/fangst.cblite2/db.sqlite3 @0x7d0951c4c0
[CouchbaseLite] [1]| [Database] {DB#3} Opening database
[CouchbaseLite] [1]| [Network] {N8litecore4blip10ConnectionE#4}==> N8litecore4blip10ConnectionE ->ws://ds9.dalsgaard-data.dk:4984/data/_blipsync @0x7d07d6fb10
[CouchbaseLite] [1]| [Network] {N8litecore4blip10ConnectionE#4} Opening connection...
[CouchbaseLite] [1]| [Replicator] Starting Scheduler<0x7d07a78e40> with 6 threads
[CouchbaseLite] [1]| [Replicator] {Repl#5}==> N8litecore4repl10ReplicatorE /data/user/0/dk.dalsgaard_data.xamarin.Couchbase/files/fangst.cblite2/ ->ws://ds9.dalsgaard-data.dk:4984/data/_blipsync @0x7d0a39b7c8
[CouchbaseLite] [1]| [Replicator] {Repl#5} Push=continuous, Pull=continuous, Options={{auth:{password:"********", type:"Basic", username:"anonymous"}, headers:{User-Agent:"CouchbaseLite/2.5.0 (.NET; Android 8.1.0 [API 27]; LGE Nexus 5X) Build/190 LiteCore/09e4c055573721d63a5e0cf1405d273a18072f11 (1782) Commit/0080df3"}, progress:1, reset:true}}
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'c4repl_getStatus'.
[Mono] Probing 'c4repl_getStatus'.
[Mono] Found as 'c4repl_getStatus'.
[CouchbaseLite] [1]| [Replicator] (Replicator) [1] Replicator[<*> ws://ds9.dalsgaard-data.dk:4984/data] is Connecting, progress 0/0
Thread started:  #8
[CouchbaseLite] [1]| [Replicator] (Replicator) [1] Replicator[<*> ws://ds9.dalsgaard-data.dk:4984/data] is Connecting, progress 0/0
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLValue_FromData'.
[Mono] Probing 'FLValue_FromData'.
[Mono] Found as 'FLValue_FromData'.
New database: - 
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLValue_GetType'.
[Mono] Probing 'FLValue_GetType'.
[Mono] Found as 'FLValue_GetType'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLValue_AsDict'.
[Mono] Probing 'FLValue_AsDict'.
[Mono] Found as 'FLValue_AsDict'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLDict_Count'.
[Mono] Probing 'FLDict_Count'.
[Mono] Found as 'FLDict_Count'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLDictIterator_Begin'.
[Mono] Probing 'FLDictIterator_Begin'.
[Mono] Found as 'FLDictIterator_Begin'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLDictIterator_GetKey'.
[Mono] Probing 'FLDictIterator_GetKey'.
[Mono] Found as 'FLDictIterator_GetKey'.
Start replication timer...
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLValue_AsString'.
[Mono] Probing 'FLValue_AsString'.
[Mono] Found as 'FLValue_AsString'.
Replication: Connecting to Sync.Gateway
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLDictIterator_GetValue'.
[Mono] Probing 'FLDictIterator_GetValue'.
[Mono] Found as 'FLDictIterator_GetValue'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLDictIterator_Next'.
[Mono] Probing 'FLDictIterator_Next'.
[Mono] Found as 'FLDictIterator_Next'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
Replication status: Couchbase.Lite.Sync.ReplicatorProgress - activity: Connecting. Completed: 0 of 0
[Mono] Searching for 'FLValue_IsInteger'.
[Mono] Probing 'FLValue_IsInteger'.
[Mono] Found as 'FLValue_IsInteger'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLValue_IsUnsigned'.
[Mono] Probing 'FLValue_IsUnsigned'.
[Mono] Found as 'FLValue_IsUnsigned'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLValue_AsInt'.
[Mono] Probing 'FLValue_AsInt'.
[Mono] Found as 'FLValue_AsInt'.
[Mono] DllImport searching in: 'LiteCore' ('libLiteCore.so').
[Mono] Searching for 'FLValue_AsBool'.
[Mono] Probing 'FLValue_AsBool'.
[Mono] Found as 'FLValue_AsBool'.
Thread finished:  #8
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_get_object_field'.
[Mono] Probing 'java_interop_jnienv_get_object_field'.
[Mono] Found as 'java_interop_jnienv_get_object_field'.
[Mono] DllImport attempting to load: '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport attempting to load: '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport attempting to load: '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation.so': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation.so': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation': 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/System/Library/Frameworks/CoreFoundation.framework/libCoreFoundation" not found'.
[Mono] DllImport attempting to load: '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport attempting to load: '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport attempting to load: '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport attempting to load: '__Internal'.
[Mono] DllImport loaded library '(null)'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'CreateNLSocket'.
[Mono] Probing 'CreateNLSocket'.
[Mono] Found as 'CreateNLSocket'.
Thread started: <Thread Pool> #9
[Choreographer] Skipped 56 frames!  The application may be doing too much work on its main thread.
[zygote64] Do partial code cache collection, code=17KB, data=29KB
[zygote64] After code cache collection, code=17KB, data=29KB
[zygote64] Increasing code cache capacity to 128KB
[zygote64] Compiler allocated 4MB to compile void android.view.View.<init>(android.content.Context, android.util.AttributeSet, int, int)
[] * Assertion at /Users/builder/jenkins/workspace/xamarin-android-d16-0/xamarin-android/external/mono/mono/metadata/threadpool-io.c:368, condition `fd >= 0' not met
[libc] Fatal signal 6 (SIGABRT), code -6 in tid 3923 (Thread Pool I/O), pid 3660 (marin.Couchbase)

The code has run with Couchbase Lite 2.1.2 and Visual Studio 2017, Xamarin Forms 3.1, and Android 8.

I just did some extra tests on another project… where Couchbase Lite and Xamarin Forms had not been updated. SAME error… so could probably be related to Android 9 and/or Visual Studio 2019

One thing I noticed is the referenced libraries under the Android project seem not to be found:
image
The message when hovering the library is “Assembly not found for Framework Xamarin.Android.v9.0 Support”. I suppose this could indicate that there needs to be a slightly different setup for Android projects under Xamarin using Couchbase Lite???

#2

I include the code for reference (could not fit into the original post):

namespace cb2.Services
{
    public class DbDataStore : IDataStore<Item>
    {
        List<Item> items;
        Database database = null;
        Replicator replicator = null;
        System.Diagnostics.Stopwatch replWatch = null;
        long lastReplMs = 0;
        ulong docCount = 0;
        ulong replTotalCount = 0;
        ulong replProgressCount = 0;
        long replProgressMs = 0;

        public DbDataStore()
        {
            Console.WriteLine("Instantiate " + this);
            items = new List<Item>();

            // Init DB
            if (null == database)
            {
				Database.Log.Console.Level = LogLevel.Info;
                database = new Database("testdb");
				docCount = database.Count;
                Console.WriteLine("Database '{0}' " + (docCount == 0 ? "created" : "opened ({1} docs)"), database.Name, docCount);
            }
            // Init Replication
            if (null == replicator)
            {
                var targetEndpoint = new URLEndpoint(new Uri("ws://ds9.dalsgaard-data.dk:4984/data"));
                var replConfig = new ReplicatorConfiguration(database, targetEndpoint);

                // Add authentication
				string USER = "anonymous";
                string PASSWORD = "xxxxxxxxxxx";
				Console.WriteLine("Log in with user: " + USER);
                replConfig.Authenticator = new BasicAuthenticator(USER, PASSWORD);
                replConfig.Continuous = true;
                replConfig.ReplicatorType = ReplicatorType.PushAndPull;

                // Create replicator
                replicator = new Replicator(replConfig);
                replicator.AddChangeListener(OnReplicationEvent);
                replicator.ResetCheckpoint();
                try
                {
                    Console.WriteLine("Try to start the replicator...");
					var token = replicator.AddDocumentReplicationListener((sender, args) =>
					{
						var direction = args.IsPush ? "Push" : "Pull";
						Console.WriteLine($"Replication type :: {direction}");
						foreach (var document in args.Documents) {
							if (document.Error != null) {
								Console.WriteLine($"Doc ID :: {document.Id}");
								if (document.Flags.HasFlag(DocumentFlags.Deleted)) {
									Console.WriteLine("Successfully replicated a deleted document");
								} else {
									// There was an error
								}
							}
						}
					});
					replicator.Start();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ERROR: " + ex.ToString());
                }
            }
        }

        void OnReplicationEvent(object sender, ReplicatorStatusChangedEventArgs arg)
        {
            {
                if (arg.Status.Activity == ReplicatorActivityLevel.Busy)
                {
                    startReplTimer();
                    Console.WriteLine("Replication: Busy transferring data");
                }
                if (arg.Status.Activity == ReplicatorActivityLevel.Connecting)
                {
                    startReplTimer();
                    Console.WriteLine("Replication: Connecting to Sync.Gateway");
                }
                if (arg.Status.Activity == ReplicatorActivityLevel.Idle)
                {
                    replTotalCount = arg.Status.Progress.Total;
                    replProgressCount = arg.Status.Progress.Completed;
                    stopReplTimer(replTotalCount > 0);
                    Console.WriteLine("Replication: Idle. Total=" + replTotalCount + ", completed=" + replProgressCount);
                    if (replTotalCount > 0)
                    {     // Only refresh if any thing replicated...
                        docCount = database.Count;
                        Console.WriteLine(" -> send message to reload!");
                        MessagingCenter.Send(this, "Replicate", replTotalCount);
                    }
                    replTotalCount = 0;
                    replProgressCount = 0;
                }
                if (arg.Status.Activity == ReplicatorActivityLevel.Offline)
                {
                    stopReplTimer(arg.Status.Progress.Total > 0);
                    Console.WriteLine("Replication: Offline");
                }
                if (arg.Status.Activity == ReplicatorActivityLevel.Stopped)
                {
                    stopReplTimer(arg.Status.Progress.Total > 0);
                    Console.WriteLine("Replication: Stopped");
                }
                Console.WriteLine($"Replication status: {arg.Status.Progress} - activity: {arg.Status.Activity}. Completed: {arg.Status.Progress.Completed} of {arg.Status.Progress.Total}");
                if (arg.Status.Error != null)
                {
                    Console.WriteLine($"Error :: {arg.Status.Error}");
                }
            }
        }

        private void startReplTimer()
        {
            // Can start in different ways - this will only start if not started
            if (null == replWatch)
            {
                Console.WriteLine("Start replication timer...");
                replWatch = System.Diagnostics.Stopwatch.StartNew();
            }
        }

        private void stopReplTimer(Boolean updateLastTime)
        {
            if (null != replWatch)
            {
                replWatch.Stop();
                if (updateLastTime)
                {
                    lastReplMs = replWatch.ElapsedMilliseconds;
                    Console.WriteLine("Stopped replication timer. Time=" + lastReplMs);
                }
                else
                {
                    Console.WriteLine("Stopped replication timer.");
                }
                replWatch = null;
            }
        }

        public async Task<bool> AddItemAsync(Item item)
        {
            items.Add(item);
            return await Task.FromResult(true);
        }

        public async Task<bool> UpdateItemAsync(Item item)
        {
            var oldItem = items.Where((Item arg) => arg.Id == item.Id).FirstOrDefault();
            items.Remove(oldItem);
            items.Add(item);
            return await Task.FromResult(true);
        }

        public async Task<bool> DeleteItemAsync(string id)
        {
            var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault();
            items.Remove(oldItem);
            return await Task.FromResult(true);
        }

        public async Task<Item> GetItemAsync(string id)
        {
            return await Task.FromResult(items.FirstOrDefault(s => s.Id == id));
        }

        public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false)
        {
            items = new List<Item>();
            if (docCount == 0)
            {
                String desc = replTotalCount == 0 ? "" : $"Replicating: { replProgressCount} of { replTotalCount} docs...";
                Console.WriteLine($"New database: - " + desc);
                items.Add(new Item { Id = "All", Text = "- new database -", Description = desc });
                return await Task.FromResult(items);
            }
            var watch = System.Diagnostics.Stopwatch.StartNew();
            // SELECT type, count(1) as count from data where type is valued group by type order by type
            using (var query = QueryBuilder.Select(
                    SelectResult.Property("type"),
                    SelectResult.Expression(Function.Count(Expression.All())).As("count"))
                   .From(DataSource.Database(database))
                   .Where(Expression.Not(Expression.Property("type").IsNullOrMissing()))
                   .GroupBy(Expression.Property("type"))
                   .OrderBy(Ordering.Property("type").Ascending()))
            {
                foreach (var result in query.Execute())
                {
                    Console.WriteLine($"{result.GetString("type")}: {result.GetInt("count")}");
                    items.Add(new Item { Id = result.GetString("type"), Text = result.GetString("type"), Description = "Count: " + result.GetInt("count") });
                }
            }
            long elapsedMs = 0;
            // SELECT count(1) as count from data
            using (var query = QueryBuilder.Select(
                    SelectResult.Expression(Function.Count(Expression.All())).As("count"))
                   .From(DataSource.Database(database)))
            {
                foreach (var result in query.Execute())
                {
                    watch.Stop();
                    elapsedMs = watch.ElapsedMilliseconds;
                    String desc = $"Count: { result.GetInt("count")}, query time: {elapsedMs} ms" + (lastReplMs == 0 ? "" : $", last repl. time {lastReplMs} ms");
                    Console.WriteLine($"All docs: - " + desc);
                    items.Add(new Item { Id = "All", Text = "- all documents -", Description = desc });
                    break;
                }
            }
            //Console.WriteLine($"Query took {elapsedMs} ms");
            return await Task.FromResult(items);
        }
    }
}
#3

… found out by further investigation that the “Assembly not found…” error is a known error in Visual Studio 2019: https://developercommunity.visualstudio.com/content/problem/514955/lost-net-assemblies-after-vs-update.html

The fix mentioned here removes the error in the references - but not in replication code…

The error looks more or less the same (here is the last part - order is slightly different):

: 
:  
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration.so" not found'.
[Mono] DllImport error loading library '/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration': 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/System/Library/Frameworks/SystemConfiguration.framework/libSystemConfiguration" not found'.
[Mono] DllImport attempting to load: '__Internal'.
[Mono] DllImport loaded library '(null)'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'CreateNLSocket'.
[Mono] Probing 'CreateNLSocket'.
[Mono] Found as 'CreateNLSocket'.
Thread started: <Thread Pool> #9
[] * Assertion at /Users/builder/jenkins/workspace/xamarin-android-d16-0/xamarin-android/external/mono/mono/metadata/threadpool-io.c:368, condition `fd >= 0' not met
[libc] Fatal signal 6 (SIGABRT), code -6 in tid 6879 (Thread Pool I/O), pid 6822 (marin.Couchbase)
[zygote64] Do partial code cache collection, code=49KB, data=57KB
[zygote64] After code cache collection, code=49KB, data=57KB
[zygote64] Increasing code cache capacity to 256KB
[zygote64] Compiler allocated 7MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
#4

The whole fd >= 0 assertion is an obnoxious bug that pops up every now and again in Xamarin’s runtime. There is nothing we can do about it, so I suggest filing an issue with them and try using a different version of Xamarin Android to build with.

#5

Ok, thanks. Just noticed when testing that it only happened if I started replication. If I don’t do that then the app runs fine with the previously replicated data (from before the various upgrades). That’s why I put it here :slight_smile:

I’ll try to go through Xamarin. Thanks!

#6

Just out of curiosity, can you create a sample app with Xamarin that can replicate with a Sync. Gateway server?

I have tried more than once - and it breaks every time. I would think that if this is a general problem you would be in a much better situation to provide some more feedback than I am. I can only say that I use that NuGet package and run some of your code :slight_smile:

If this is a general problem (as you indicate) I would guess it would hit many more developers using Couchbase Lite. I have tried my samples again after upgrading to the latest VS 2019. This is my installation:

Visual Studio Professional 2019 for Mac
Version 8.0.6 (build 4)
Installation UUID: 0e93c0c9-35a7-4964-a385-abee678b36e8
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 5.6.0.2 (d16-0 / 040682909)

	Package version: 518010003

Mono Framework MDK
Runtime:
	Mono 5.18.1.3 (2018-08/fdb26b0a445) (64-bit)
	Package version: 518010003

NuGet
Version: 4.8.2.5835

.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.1.9
	2.1.8
	2.1.7
	2.1.3
	2.1.2
	2.1.1
	2.0.5
SDK: /usr/local/share/dotnet/sdk/2.1.505/Sdks
SDK Versions:
	2.1.505
	2.1.504
	2.1.503
	2.1.401
	2.1.302
	2.1.301
	2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/msbuild/15.0/bin/Sdks
#7

Hey @jda

This example app does SG syncing…

#8

Hi @blake.meike

Thanks for the link. Have you tried running it on an Android device from Visual Studio 2019 on Mac? I can see that the repo is around a year old…

Because that is my problem. It started after upgrading everything (VS 2019, Couchbase Lite 2.5, etc. etc.). So I really want to know if someone else can do this? If they can then something is wrong in my app - and I have a chance to fix it. If not then this is a general problem that (in my opinion) is best driven by someone at Couchbase that can provide much better input to the Xamarin/Visual Studio folks.

#9

Hi @jda,

I think it should not be a problem running Xamarin Android from VS2019 on Mac.

I believe our product team has update the Lite API version 2.5 and ran it successfully. (12 days ago)

Please let me know if that’s not the case and I will look into it. PS. I haven’t run any of our sample app using VS2019 though. I am using VS2017.

ALSO: Here is the Tutorial: https://docs.couchbase.com/tutorials/mobile-travel-sample/introduction.html

-Sandy