Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception. #34704

Open
Vic-tator opened this issue Sep 18, 2024 · 3 comments

Comments

@Vic-tator
Copy link

File a bug

I am trying to upgrade from version 6.0.23 to 9.0.0-rc.1.24451.1

<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.0-rc.1.24451.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0-rc.1.24451.1" />

Tried version 8 got the same error.

Include your code

in the code i am trying to run this:
_sqliteConnection = new SqliteConnection("Data Source=:memory:");
_sqliteConnection.Open();

Include stack traces

System.TypeInitializationException: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.DllNotFoundException: Unable to load shared library 'e_sqlite3' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
Error loading shared library /app/e_sqlite3.so: No such file or directory
Error loading shared library /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.8/e_sqlite3.so: No such file or directory
Error loading shared library e_sqlite3.so: No such file or directory
Error relocating /app/libe_sqlite3.so: fcntl64: symbol not found
Error loading shared library /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.8/libe_sqlite3.so: No such file or directory
Error loading shared library libe_sqlite3.so: No such file or directory
Error loading shared library /app/e_sqlite3: No such file or directory
Error loading shared library /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.8/e_sqlite3: No such file or directory
Error loading shared library e_sqlite3: No such file or directory
Error loading shared library /app/libe_sqlite3: No such file or directory
Error loading shared library /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.8/libe_sqlite3: No such file or directory
Error loading shared library libe_sqlite3: No such file or directory

at SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_libversion_number()
at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()
at SQLitePCL.raw.SetProvider(ISQLite3Provider imp)
at SQLitePCL.Batteries_V2.Init()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
at Microsoft.Data.Sqlite.SqliteConnection..cctor()
--- End of inner exception stack trace ---
at Microsoft.Data.Sqlite.SqliteConnection..ctor(String connectionString)

@cincuranet
Copy link
Contributor

Based on the fcntl64: symbol not found, it looks like you don't have new-enough glibc installed on your system.

@Vic-tator
Copy link
Author

What minimum version should i use?
For now this is what installed on 8.0-alpine-amd64
/lib $ ldd --version
musl libc (x86_64)
Version 1.2.5
Dynamic Program Loader
Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname

@cincuranet
Copy link
Contributor

The fcntl64 was introduced in glibc 2.28. But you're using musl and I'm not sure musl has it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants