Couchbase Lite Support NetDesktop 2.6 crashes on line of code removed for issue #1172

Using Couchbase Lite Support NetDesktop 2.6 in my .NET Windows program makes it crash on the line of code removed in the commit for this issue:

2.5.3 doesn’t have this problem. I could use a 2.6.1 with this commit included.

Notice that 2.6.0 also adding the Obsolete attribute, so you can simply remove the call to Activate() if it is causing you issues.

1 Like

When I remove the Activate() function when I touch anything Couchbase Lite (file logging config, DatabaseConfiguration) I get (or similar, but always getDomain):

Unable to load DLL ‘LiteCore’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

at LiteCore.Interop.Native.c4log_getDomain(Byte* name, Boolean create)
at Couchbase.Lite.Logging.FileLogger.SetupDomainObjects()
at Couchbase.Lite.Logging.FileLogger…ctor()
at Couchbase.Lite.Logging.Log…ctor()
at Couchbase.Lite.Database…cctor()

I would expect that behavior for versions prior to 2.6.0 but not the 2.6.0 and higher. If you look at the commit all it does is some checking about the versions it detects in the current application’s runtime (those turned out to be unreliable which is why I had them removed). My first thought would be that you are getting an earlier version pulled into your build at some point.

EDIT Try re-enabling the Activate() call. I assumed that the exception was the one I was facing (inability to properly detect version) but if you see a message about “version mismatch” then you have a problem.

Activate() does not work:

Couchbase.Lite not detected in app loaded assemblies

at Couchbase.Lite.Support.NetDesktop.CheckVersion() in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Support.NetDesktop\Activate.cs:line 70
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 50
at VegaLib.Vega.AviaMapHandler.AviaMapApi_InitializeAviaMap(Object sender, InitialiseAviaMapEventArgs initialiseAviaMapEventArgs) in C:\Users\steve\Documents\Projects\Vega.Lib\VegaLib\Vega\AviaMapHandler.cs:line 47

There should be no problem in removing it because as you can see all the commit did was remove the one line inside and make it into a no-op. The fact that it complains when you remove it strongly suggests to me that you have an older version of either Couchbase.Lite or Couchbase.Lite.Support.NetDesktop rumbling around somewhere in your project.

I found out why this happens and the first and foremost reason is that I clump .NET Core and .NET Framework together because they usually function so identically. In this case some differences in the .NET compiler between Windows versions (2012 vs 10) meant that a key function call was not compiled into the final product (For legacy reasons we have a 2012 build server, and a Windows 10 testing machine). Details about the issue, including two workarounds are here.

I tried workaround number 2 and this solved the problem.

Is this something that will be “fixed” in the next update?

Yes, Mercury is our next release and the ticket I linked is scheduled for that. It’s an easy fix on our side and if there are any maintenance releases between now and then (i.e. 2.6.1) then I’ll make sure it goes into that too.