Upgrading CBL from 1.4->2.1. Can't get any unit tests to work with CBL

Trying to keep a suite of unit tests as we migrate from 1.4 to 2.1. However, I can’t get a simple NUnit Test class to successfully call into the CBL libraries.

Details:
Visual Studio for Mac
NUnit Test Project
Targeting 4.7 .Net Framework

Couchbase.Lite.Support.NetDesktop.Activate();
var testDb = new Couchbase.Lite.Database("testdb");

New Database() fails with:

{System.TypeInitializationException: The type initializer for ‘Couchbase.Lite.Sync.HTTPLogic’ threw an exception. —> System.DllNotFoundException: LiteCore at (wrapper managed-to-native) LiteCore.Interop.NativeRaw.c4_getVersion() at LiteCore.Interop.Native…}

Looking for a way I can keep these unit tests w CBL.

.NET Framework on Mac (aka Mono) is not a supported deployment case. Can you try with .NET Core instead?

Thanks for the reply!

I spun up a new NUnit3 test project targeting .Net Core 2.0. Everything checks out.
I added the CBL 2.1.0-db001 release. On the call to Activate I now get:

{System.InvalidOperationException: The container can't be changed after the first call to GetInstance, GetAllInstances and Verify. Please see https://simpleinjector.org/locked to understand why the container is locked.    at SimpleInjector.Container.ThrowWhenContainerIsLockedOrDisposed()    at SimpleInjector.Container.AddRegistrationInternal(Type serviceType, Registration registration)    at Couchbase.Lite.DI.Service.AutoRegister(Assembly assembly) in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\API\DI\Service.cs:line 94    at Couchbase.Lite.Support.NetDesktop.Activate() in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Support.NetDesktop\Activate.cs:line 104    at Tests.Tests.Test1()

It should be called only once. That might happen if you call it at every test for example.

Sure. But this is the first and only test in this project. Activate is only being called this one time.

Edit: I had a call to new Database() in the setup that was causing the trouble.

Saw your edit just now but I was going to ask if it was the first thing you did before any other Couchbase code. Seems like you found out the problem.