There is a section in the documentation that specifies that CouchbaseLite-iOS is not thread-safe and recommend to do things like “not use sharedInstance”. Does this apply to the CouchbaseLite.NET library when used in a Xamarin iOS app? Should I use the Manager.sharedInstance or create a new instance with each access? Should database operations always be on the main thread or background thread?
The Objective-C implementation follows the typical behavior of Cocoa classes: the classes are not themselves thread-safe, so the app is responsible for calling them safely. In addition, some of the classes post NSNotifications and need to know what runloop or dispatch queue to deliver the notifications on. Therefore, each thread or dispatch queue that you use Couchbase Lite on should have its own set of Couchbase Lite objects
If your app uses Couchbase Lite on multiple threads, then on each thread (or dispatch queue) it must:
Create a new CBLManager instance. If you use multiple threads, do not use the sharedInstance.
Use only objects (Databases, Documents, …) acquired from its Manager.
Not pass any Couchbase Lite objects to code running on any other thread/queue.