I have a windows console app that was running couchbase lite 2.1 and working. I updated it to couchbase 2.6 but I get an exception when I try and set the URLEndpoint for the database. as seen below.
var url = new Uri(hq);
var target = new URLEndpoint(url); --------------------> Throws a “The type initializer for ‘Couchbase.Lite.Internal.Logging.WriteLog’ threw an exception”
The inner exception of this error is Unable to load DLL ‘LiteCore’: The specified module could not be found. (Exception from HRESULT: 0x8007007E) with a stack trace of at LiteCore.Interop.Native.c4log_getDomain(Byte* name, Boolean create)
at Couchbase.Lite.Internal.Logging.WriteLog.c4log_getDomain(String name, Boolean create)
What am I missing here? does 2.6 need a different version of VC++
The library was changed to a multi target project that automatically loads the library instead of you needing to call
Activate() but I have not observed any issue like this. The build machine is still using the same VS 2015 to build. If you are sure that the native libraries are still being copied to the final output then the next thing to check is dependency walker to see if any dependencies are missing (I don’t think I added any but accidents happen).
I’m getting a very similar error with 2.6.0 (was fine with 2.5.3):
[DllNotFoundException: Unable to load DLL ‘LiteCore’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
LiteCore.Interop.Native.c4log_getDomain(Byte* name, Boolean create) +0
Couchbase.Lite.Internal.Logging.WriteLog.c4log_getDomain(String name, Boolean create) in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Log\Log.cs:116
Couchbase.Lite.Internal.Logging.WriteLog…cctor() in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Log\Log.cs:46
[TypeInitializationException: The type initializer for ‘Couchbase.Lite.Internal.Logging.WriteLog’ threw an exception.]
Couchbase.Lite.Internal.Doc.InMemoryDictionary.SetObject(String key, Object value) in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Document\InMemoryDictionary.cs:86
Couchbase.Lite.Internal.Doc.InMemoryDictionary.SetString(String key, String value) in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Document\InMemoryDictionary.cs:293
Could you use Dependency Walker to see if there are any unresolved dependencies for LiteCore.dll?
EDIT Ignore anything that starts with
Got it working, apparently 2.6 copied litecore.dll to x64 and x86 folders respectively. I just copied the one i was using to the root of the bin and that solved it. 2.1 apparently copied it to the root itself.