Skip to content

SQLite: Unable to open database file with UWP #19468

@emyfreya

Description

@emyfreya

Passing Data Source=MyDatabase.db does not work anymore when calling DbContextOptionsBuilder.UseSqlite(string).

The exception thrown is :

An error occurred using the connection to database 'main' on server 'MyDatabase.db'.
Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in System.Private.CoreLib.dll
SQLite Error 14: 'unable to open database file'.

Previously, it put the specified database into the LocalState folder.

This has also been reported here, but the solution does not satisfy me as I code to get the current package LocalState folder.

Steps to reproduce

Create a basic UWP app with a DbContext and use the method UseSqlite("Data Source=MyDatabase.db"). Then try creating the database or use the Database.MigrateAsync method.

Further technical details

EF Core version: 3.1.0
Database provider: Microsoft.EntityFrameworkCore.Sqlite
Target framework: UWP
Operating system: Windows 10
IDE: Visual Studio 2019 16.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions