Skip to content

Microsoft.EntityFrameworkCore.SQLite on Android 7+ not working #8922

@tipa

Description

@tipa

I was successfully using Microsoft.EntityFrameworkCore.SQLite v.1.1.2 in a Xamarin.Android project. But for Android 7+, the app crashes with unauthorized access to "/system/lib64/libsqlite.so" (as reported here).

So I updated to version v2.0.0-preview1-final as this should fix the issue.
However, this results in other problems like the following where the app compiled, but crashed while deploying/starting on the emulator:

...
06-21 09:58:18.970 D/Mono    ( 3632): Assembly Loader probing location: 'System.Runtime.CompilerServices.Unsafe'.
06-21 09:58:18.970 F/monodroid-assembly( 3632): Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.
06-21 09:58:18.970 F/monodroid-assembly( 3632): This might be due to an invalid debug installation.

I then tried to add the 'System.Runtime.CompilerServices.Unsafe' NuGet package manually to my project, but it didnt fix the problem. I messed around a lot, trying different build parameters and such and actually got the app running on an Android 7 emulator. However, after a project clean and rebuild, the error showed up again.

Any help on how to get EFCore Sqlite to work on Android 7?

Steps to reproduce

Sample project: https://github.com/tipa/EFCoreSample
(Basically just the basic Android template from VS + the Nuget preview package)

Further technical details

EF Core version: v2.0.0-preview1-final
Database Provider: Microsoft.EntityFrameworkCore.Sqlite
Xamarin: 4.5.0.486
Xamarin.Android: 7.3.1.2
Operating system: Windows 10
IDE: Visual Studio 2017 15.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions