Could not resolve type with token 0100009c (from typeref, class/assembly Couchbase.Lite.StorageEngineTypes couchbse lite

Hi @borrrden,

I have converted my project from pcl to .net standard for couchbase new nuget pacakge updation. Also added the needed nuget packages like customsqlite, forestdb, systemsqlite etc.

But now it gives error on customsqlite register event.

        Couchbase.Lite.Storage.CustomSQLite.Plugin.Register();

On this line it gives error like this.

Could not resolve type with token 0100009c (from typeref, class/assembly Couchbase.Lite.StorageEngineTypes, Couchbase.Lite, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null)

So can you help me with that why this is happening.

Thanks in Advance.

Usually this error has to do with mismatched nuget versions between projects, or nuget projects not being copied correctly to the final output. However what you are doing is in unsupported territory so beware of dragons.

Hi @borrrden

I have made nuget packages version same for all projects. I am still facing that error.

So are you trying to say that couchbase lite .net standard is not compatible with xamarin forms?

P.S. I have only added couchbase lite , systemsqlite, forestdb, sqlcipher and custom sqlite packages.

Thanks.

Couchbase Lite 1.x is not compatible with .NET Standard. Furthermore, if you are using Couchbase Lite 2.x then the “Storage” packages are not compatible (and not needed). That could be another reason you are facing this issue (notice that the storage packages are all 1.4.1 while the main package continues to 2.0.3).

Hi @borrrden

Thanks for the reply.

But if I not included customsqlite package and other related packages it gives me error.

The type initializer for ‘Couchbase.Lite.Sync.HTTPLogic’ threw an exception.

Here is the stack trace.

at Couchbase.Lite.Sync.HTTPLogic.GetUserAgent () [0x00152] in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Sync\HTTPLogic.cs:239
at Couchbase.Lite.Sync.HTTPLogic…cctor () [0x00000] in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Sync\HTTPLogic.cs:47

When I see inner exception it shows this.

{System.TypeInitializationException: The type initializer for ‘Couchbase.Lite.Interop.Native’ threw an exception. —> System.InvalidOperationException: A required dependency injection class is missing (LiteCore.Interop.ILiteCore).
Please ensure that you have called the proper Activate() class in the
support assembly (e.g. Couchbase.Lite.Support.UWP.Activate()) or that you
have manually registered dependencies via the Couchbase.Lite.DI.Service
class.
at Couchbase.Lite.DI.Service.GetRequiredInstance[T] () [0x00000] in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\API\DI\Service.cs:156
at Couchbase.Lite.Interop.Native…cctor () [0x00000] in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\LiteCore\src\LiteCore.Shared\Interop\LiteCore_shell_defs.cs:31
— End of inner exception stack trace —
at Couchbase.Lite.Sync.HTTPLogic.GetUserAgent () [0x00152] in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Sync\HTTPLogic.cs:239
at Couchbase.Lite.Sync.HTTPLogic…cctor () [0x00000] in C:\Jenkins\workspace\couchbase-lite-net-edition-build\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Shared\Sync\HTTPLogic.cs:47 }

I am really stuck with this. Can you help me with that.

Thank you.

It is referring to another assembly. Have you consulted the 2.0 getting started instructions?

Hi @borrrden,

Thank you for the reply.

I have done the same, added the activate method in mainactivity.cs and it works.

Thanks for the help again.