SQLite stopped working on Xamarin.Forms (Android) since May 31st
Since the previous Friday (Mat 31st), my project which targets Android/iOS/UWP stopped working on Android. (I haven't tested iOS and UWP yet to see if the same issue happens)
The project has a few small tables that are created/migrated using a MigrateAsync during start. It was working nicely before.
I found someone on StackOverflow with the same exact issue, that started happening on the same day:
https://stackoverflow.com/questions/56355254/sqlite-no-longer-seems-to-work-on-xamarin-android
Here's the output:
06-04 22:26:05.992 D/Mono (19993): Prepared to set up assembly 'System.Runtime.Extensions' (System.Runtime.Extensions.dll)
06-04 22:26:05.992 D/Mono (19993): Assembly System.Runtime.Extensions[0x71eacb2c80] added to domain RootDomain, ref_count=1
06-04 22:26:05.995 D/Mono (19993): AOT: image 'System.Runtime.Extensions.dll.so' not found: dlopen failed: library "System.Runtime.Extensions.dll.so" not found
06-04 22:26:05.996 D/Mono (19993): AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d16-1/xamarin-android/external/mono/sdks/out/android-arm64-v8a-release/lib/mono/aot-cache/arm64/System.Runtime.Extensions.dll.so' not found: dlopen failed: library "/Users/builder/jenkins/workspace/xamarin-android-d16-1/xamarin-android/external/mono/sdks/out/android-arm64-v8a-release/lib/mono/aot-cache/arm64/System.Runtime.Extensions.dll.so" not found
06-04 22:26:05.996 D/Mono (19993): Config attempting to parse: 'System.Runtime.Extensions.dll.config'.
06-04 22:26:05.996 D/Mono (19993): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d16-1/xamarin-android/external/mono/sdks/out/android-arm64-v8a-release/etc/mono/assemblies/System.Runtime.Extensions/System.Runtime.Extensions.config'.
06-04 22:26:05.996 D/Mono (19993): Assembly Ref addref Remotion.Linq[0x71f365e380] -> System.Runtime.Extensions[0x71eacb2c80]: 2
06-04 22:26:05.996 D/Mono (19993): Loading reference 0 of System.Runtime.Extensions.dll asmctx DEFAULT, looking for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
06-04 22:26:05.996 D/Mono (19993): Assembly Ref addref System.Runtime.Extensions[0x71eacb2c80] -> mscorlib[0x720b886680]: 67
06-04 22:26:06.191 D/Mono (19993): Loading reference 8 of /storage/emulated/0/Android/data/com.batman/files/.__override__/Microsoft.EntityFrameworkCore.Sqlite.dll asmctx DEFAULT, looking for Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b
06-04 22:26:06.191 D/Mono (19993): Assembly Ref addref Microsoft.EntityFrameworkCore.Sqlite[0x71f364a500] -> Remotion.Linq[0x71f365e380]: 4
06-04 22:26:06.269 D/Mono (19993): Loading reference 7 of /storage/emulated/0/Android/data/com.batman/files/.__override__/Microsoft.EntityFrameworkCore.Sqlite.dll asmctx DEFAULT, looking for Microsoft.Data.Sqlite, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
06-04 22:26:06.269 D/Mono (19993): Assembly Ref addref Microsoft.EntityFrameworkCore.Sqlite[0x71f364a500] -> Microsoft.Data.Sqlite[0x71f364a000]: 2
06-04 22:26:06.386 D/Mono (19993): Loading reference 1 of /storage/emulated/0/Android/data/com.batman/files/.__override__/Microsoft.Data.Sqlite.dll asmctx DEFAULT, looking for SQLitePCLRaw.core, Version=1.1.12.351, Culture=neutral, PublicKeyToken=1488e028ca7ab535
06-04 22:26:06.386 D/Mono (19993): Assembly Ref addref Microsoft.Data.Sqlite[0x71f364a000] -> SQLitePCLRaw.core[0x71f365e780]: 2
06-04 22:26:06.387 D/Mono (19993): Loading reference 5 of System.Data.dll asmctx DEFAULT, looking for System.Transactions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
06-04 22:26:06.387 D/Mono (19993): Assembly Ref addref System.Data[0x71ec4aa600] -> System.Transactions[0x71eacb2480]: 3
06-04 22:26:06.390 D/Mono (19993): Loading reference 1 of /storage/emulated/0/Android/data/com.batman/files/.__override__/SQLitePCLRaw.batteries_v2.dll asmctx DEFAULT, looking for SQLitePCLRaw.provider.e_sqlite3, Version=1.1.12.351, Culture=neutral, PublicKeyToken=9c301db686d0bd12
06-04 22:26:06.391 D/Mono (19993): Assembly Ref addref SQLitePCLRaw.batteries_v2[0x71f365e680] -> SQLitePCLRaw.provider.e_sqlite3[0x71f365e980]: 2
06-04 22:26:06.391 D/Mono (19993): Loading reference 1 of /storage/emulated/0/Android/data/com.batman/files/.__override__/SQLitePCLRaw.provider.e_sqlite3.dll asmctx DEFAULT, looking for SQLitePCLRaw.core, Version=1.1.12.351, Culture=neutral, PublicKeyToken=1488e028ca7ab535
06-04 22:26:06.391 D/Mono (19993): Assembly Ref addref SQLitePCLRaw.provider.e_sqlite3[0x71f365e980] -> SQLitePCLRaw.core[0x71f365e780]: 3
06-04 22:26:06.392 D/Mono (19993): Loading reference 2 of /storage/emulated/0/Android/data/com.batman/files/.__override__/SQLitePCLRaw.batteries_v2.dll asmctx DEFAULT, looking for SQLitePCLRaw.core, Version=1.1.12.351, Culture=neutral, PublicKeyToken=1488e028ca7ab535
06-04 22:26:06.392 D/Mono (19993): Assembly Ref addref SQLitePCLRaw.batteries_v2[0x71f365e680] -> SQLitePCLRaw.core[0x71f365e780]: 4
06-04 22:26:06.395 D/Mono (19993): DllImport attempting to load: 'e_sqlite3'.
06-04 22:26:06.396 D/Mono (19993): DllImport error loading library '/storage/emulated/0/Android/data/com.batman/files/.__override__/libe_sqlite3': 'dlopen failed: library "/storage/emulated/0/Android/data/com.batman/files/.__override__/libe_sqlite3" not found'.
06-04 22:26:06.398 D/Mono (19993): DllImport error loading library '/storage/emulated/0/Android/data/com.batman/files/.__override__/libe_sqlite3.so': 'dlopen failed: library "/storage/emulated/0/Android/data/com.batman/files/.__override__/libe_sqlite3.so" not found'.
06-04 22:26:06.398 D/Mono (19993): DllImport error loading library '/system/lib/libe_sqlite3': 'dlopen failed: library "/system/lib/libe_sqlite3" not found'.
06-04 22:26:06.398 D/Mono (19993): DllImport error loading library '/system/lib/libe_sqlite3.so': 'dlopen failed: library "/system/lib/libe_sqlite3.so" not found'.
06-04 22:26:06.400 D/Mono (19993): DllImport error loading library 'libe_sqlite3': 'dlopen failed: library "libe_sqlite3" not found'.
06-04 22:26:06.400 D/Mono (19993): DllImport loaded library 'libe_sqlite3.so'.
06-04 22:26:06.400 D/Mono (19993): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
06-04 22:26:06.400 D/Mono (19993): Searching for 'sqlite3_libversion_number'.
06-04 22:26:06.417 D/Mono (19993): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
06-04 22:26:06.417 D/Mono (19993): Searching for 'sqlite3_open_v2'.
06-04 22:26:06.425 D/Mono (19993): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
06-04 22:26:06.425 D/Mono (19993): Searching for 'sqlite3_errcode'.
06-04 22:26:06.426 D/Mono (19993): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
06-04 22:26:06.426 D/Mono (19993): Searching for 'sqlite3_errmsg'.
06-04 22:26:06.427 D/Mono (19993): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
06-04 22:26:06.427 D/Mono (19993): Searching for 'sqlite3_extended_errcode'.
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Basic Fault Adddress Reporting
=================================================================
Memory around native instruction pointer (0x71f3208678):0x71f3208668 00 1c
06-04 22:26:06.436 E/mono-rt (19993): /proc/self/maps:
06-04 22:26:06.436 E/mono-rt (19993): 12c00000-13300000 rw-p 00000000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
06-04 22:26:06.436 E/mono-rt (19993): 13300000-136c0000 rw-p 00700000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
40 b9 c0 03 5f d6 fd 7b bf a9 fd 03 00 91 ..@..._..{......
0x71f3208678 08 20 40 b9 a8 00 c8 37 88 01 e0 37 00 00 40 f9 . @....7...7..@.
0x71f3208688 fd 7b c1 a8 c0 03 5f d6 60 08 00 b0 01 0a 00 f0 .{...._.`.......
0x71f3208698 03 0a 00 f0 00 24 06 91 21 80 08 91 63 8c 0a 91 .....$..!...c...
No native Android stacktrace (see debuggerd output).
=================================================================
Managed Stacktrace:
=================================================================
=================================================================06-04 22:26:06.436 E/mono-rt (19993): 136c0000-14080000 ---p 00ac0000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
06-04 22:26:06.436 E/mono-rt (19993): 14080000-140c0000 rw-p 01480000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
06-04 22:26:06.436 E/mono-rt (19993): 140c0000-14100000 ---p 014c0000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
06-04 22:26:06.436 E/mono-rt (19993): 14100000-14140000 rw-p 01500000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
06-04 22:26:06.436 E/mono-rt (19993): 14140000-14180000 ---p 01540000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
06-04 22:26:06.436 E/mono-rt (19993): 14180000-32c00000 rw-p 01580000 00:05 14033 /dev/ashmem/dalvik-main space (region space) (deleted)
06-04 22:26:06.436 E/mono-rt (19993): 70711000-70729000 rw-p 00000000 103:35 3156951 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70729000-7072b000 r--p 00018000 103:35 3156951 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 7072b000-70737000 rw-p 00000000 103:35 3156961 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70737000-70738000 r--p 0000c000 103:35 3156961 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70738000-70743000 rw-p 00000000 103:35 3156975 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70743000-70744000 r--p 0000b000 103:35 3156975 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70744000-70745000 rw-p 00000000 103:35 3156989 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70745000-70746000 r--p 00001000 103:35 3156989 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70746000-70748000 rw-p 00000000 103:35 3157035 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70748000-70749000 r--p 00002000 103:35 3157035 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70749000-7074a000 rw-p 00000000 103:35 3157057 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 7074a000-7074b000 r--p 00001000 103:35 3157057 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 7074b000-70a0e000 rw-p 00000000 103:35 3157066 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70a0e000-70a22000 r--p 002c3000 103:35 3157066 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70a22000-70b57000 rw-p 00000000 103:35 3157070 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70b57000-70b69000 r--p 00135000 103:35 3157070 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.436 E/mono-rt (19993): 70b69000-70ba8000 rw-p 00000000 103:35 3157083 /data/dalvik-cache/arm64/system@[email protected]
06-04 22:26:06.438 F/libc (19993): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 19993 (com.batman), pid 19993 (com.batman)
Cause: null pointer dereference
x0 0000000000000000 x1 0000000000000000 x2 0000000000000000 x3 0000007fc3f80860
x4 0000007202f5d9a0 x5 0000007fc3f808f0 x6 0000000000000000 x7 0000000000000000
x8 0000000000000000 x9 0000000000000000 x10 0000000000000000 x11 0000000000000000
x12 0000000000000000 x13 0000000000000000 x14 0000000000000000 x15 aaaaaaaaaaaaaaab
x16 00000071f33e11f8 x17 00000071f3208670 x18 0000000000000008 x19 00000071f33f8560
x20 0000000000000002 x21 0000000000000000 x22 0000000000000000 x23 000000000000007f
x24 0000000000000000 x25 0000000000000000 x26 0000007fc3f809e0 x27 00000071eb1a5360
x28 0000007202f5d000 x29 0000007fc3f7fd00
sp 0000007fc3f7fd00 lr 00000071f314f658 pc 00000071f3208678
Steps to reproduce
I'm going to provide the project that the other person created, since it's the same error: https://github.com/neville-nazerane/xamarin-site
Further technical details
EF Core version: 2.2.4 of EFCore.SQLite Database Provider: Microsoft.EntityFrameworkCore.SQLite Operating system: Windows 17763.529 IDE: Visual Studio 2019 16.1.1
I tried to create a very simple project with just one table and nothing else and the same issue happens. It works ok on an emulator.
cc @ericsink
That's weird.
I cannot imagine why this would be date-related.
I'll dig a bit deeper and see what I can find.
@ericsink Well it could be the release date of some package, OS update, etc. But of course, it can be just a coincidence.
I just retired a new empty xamarin project and found the error. Basically, I just tried this:
using (var db = new AppDbContext())
{
db.Add(new Person {
Age = 55,
Name = "Neville"
});
db.SaveChanges();
Person[] alldata = db.People.ToArray();
}
class AppDbContext : DbContext
{
public DbSet<Person> People { get; set; }
public AppDbContext()
{
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=" + Path.Combine(FileSystem.AppDataDirectory, "sample.sql"));
base.OnConfiguring(optionsBuilder);
}
}
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }
}
It breaks after the using.
i have same problem: https://github.com/aspnet/EntityFrameworkCore/issues/15935
i have same problem: #15935
Don't think this is the same problem. Although it is related to sqlite and xamarin.forms, the error message and behavior seem quite different.
So, it's a bigger issue... Aparently something was changed, fixed, but there's a regression.
https://github.com/xamarin/xamarin-android/issues/2920 https://github.com/xamarin/xamarin-android/issues/3112
Looks like we may need to just wait for a fix from Xamarin.
:(
A fix is on the way.
It fixed on 16.1.3 version
Yes. It was fixed in 16.1.3.
Having this Issue again, was there a Regression?