Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-428

.NET Framework build does not load LiteCore properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 2.7.0
    • 2.6.0
    • .NET
    • Security Level: Public
    • None
    • CBL Sprint 5
    • 2

    Description

      .NET Core is able to do this automatically, but .NET Framework fails to do so starting in 2.6.0.  The reason for this is an inconsistency in Windows with what it actually defines with its compiler.  On Windows 10, the NETFRAMEWORK define is present by default (which is what is used for testing) but on Windows Server 2012 (server variant of Windows 8.x which is used for building) it is not present and so the critical logic for loading the native LiteCore library is not compiled in and the result is that nothing works.

      There are two workarounds here:

      1. Copying the proper native LiteCore.dll into the same directory as the outputted .NET application (After you build the app you can find the two in the x86 and x64 folders of the application output directory [e.g. bin/Debug/x64])
      2. This line of code will use reflection to call the proper method:

        Type.GetType("Couchbase.Lite.Support.NetDesktop, Couchbase.Lite.Support.NetDesktop").GetMethod("LoadLiteCore", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null);
         

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sandy.chuang Sandy Chuang (Inactive)
            jimb Jim Borden
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty