question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to load shared library 'e_sqlite3' exception with net6 rc1 and efcore Microsoft.EntityFrameworkCore.Sqlite.Core 6.0.0-rc.1.21452.1

See original GitHub issue

I’m struggling to get ef core 6.0.0-rc.1.21452.1 and the rc1 net core 6.0 working with sqlite I’m running the code inside a docker container mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1-focal

I’m attempting to run some tests against code that normally uses efcore against SQL server but in the tests I’ve been using sqlite in memory database - this was all working with the v5 versions of netcore and ef etc

I have the following package refs:

<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0-rc.1.21452.15" />
    <PackageReference Include="Microsoft.Data.Sqlite" Version="2.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="6.0.0-rc.1.21452.10" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
    <PackageReference Include="Moq" Version="4.16.1" />
    <PackageReference Include="NUnit" Version="3.13.1" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
    <PackageReference Include="coverlet.collector" Version="3.0.2" />
    <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.6" />
    <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.0.6" />
    <PackageReference Include="SQLitePCLRaw.core" Version="2.0.6" />
    <PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.0.6" />
    <PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.linux" Version="1.1.14" />

(I’ve tried many combinations of the above packages)

And I get the following exception logs

--TargetInvocationException
#18 5.754    at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
#18 5.754    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
#18 5.754    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
#18 5.754    at Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize()
#18 5.754    at Microsoft.Data.Sqlite.SqliteConnection..cctor()
#18 5.754 --DllNotFoundException
#18 5.754    at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
#18 5.754    at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
#18 5.754    at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable`1 searchPath)
#18 5.754    at SQLitePCL.NativeLibrary.Load(String libraryName, Assembly assy, Int32 flags)
#18 5.754    at SQLitePCL.Batteries_V2.MakeDynamic(String name, Int32 flags)
#18 5.754    at SQLitePCL.Batteries_V2.DoDynamic_cdecl(String name, Int32 flags)
#18 5.754    at SQLitePCL.Batteries_V2.Init()
#18 5.754   Failed HandlerReturnsPipelineWhenSubIsMatch [< 1 ms]
#18 5.754   Error Message:
#18 5.754    System.TypeInitializationException : The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception.
#18 5.754   ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
#18 5.754   ----> System.DllNotFoundException : Unable to load shared library 'e_sqlite3' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libe_sqlite3: cannot open shared object file: No such file or directory
#18 5.754   Stack Trace:
#18 5.754      at Microsoft.Data.Sqlite.SqliteConnection..ctor(String connectionString)

Is this a known issue or am I missing some prereqs in the docker container - I’ve added the following to my dockerfile

RUN apt-get update
RUN apt-get install -y nodejs yarn sqlite3

but otherwise its the stock SDK image

The same project works as expected on windows 10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bricelamcommented, Oct 8, 2021

Those package references still seem problematic. You’re mixing two versions of SQLitePCLRaw (2.0.6 and 1.1.14), and you have two bundles installed (e_sqlite3 and green).

0reactions
ajcvickerscommented, Oct 19, 2021

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we’d like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found