Skip to content

The Sqlite EFCore integration creates an "invalid" connection string #690

Open
@mattleibow

Description

@mattleibow

Describe the bug

When using the integration like this:

var db = builder.AddSqlite("db")
var web = builder.AddProject<Projects.Hybridisms_Server_WebApp>("webapp")
    .WithReference(db);

It creates a connection string:

Data Source=C:\Users\maleib\AppData\Local\Temp\kt0c3e1b.cve.db;Cache=Shared;Mode=ReadWriteCreate;Extensions=[]

Specifically, it adds the Extensions=[] to the end, which does not seem to be a supported keyword:

https://github.com/dotnet/efcore/blob/d0237c7e0c3192b00766d6a163fe2a5def526e03/src/Microsoft.Data.Sqlite.Core/SqliteConnectionStringBuilder.cs#L42-L53

And, when I access the DB, I get this:

[Exception] Microsoft.Data.Sqlite.dll!Microsoft.Data.Sqlite.SqliteConnectionStringBuilder.GetIndex(string keyword) Line 359
	at Microsoft.Data.Sqlite\SqliteConnectionStringBuilder.cs(359)
[Exception] Microsoft.Data.Sqlite.dll!Microsoft.Data.Sqlite.SqliteConnectionStringBuilder.this[string].set(string keyword, object value) Line 200
	at Microsoft.Data.Sqlite\SqliteConnectionStringBuilder.cs(200)
[Exception] System.Data.Common.dll!System.Data.Common.DbConnectionStringBuilder.ConnectionString.set(string value)
[Exception] Microsoft.Data.Sqlite.dll!Microsoft.Data.Sqlite.SqliteConnectionStringBuilder.SqliteConnectionStringBuilder(string connectionString) Line 255
	at Microsoft.Data.Sqlite\SqliteConnectionStringBuilder.cs(255)
[Exception] Microsoft.EntityFrameworkCore.Sqlite.dll!Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteDatabaseCreator.Exists()
[Exception] Microsoft.EntityFrameworkCore.Relational.dll!Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.ExistsAsync(System.Threading.CancellationToken cancellationToken)
[Exception] Microsoft.EntityFrameworkCore.Relational.dll!Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreatedAsync(System.Threading.CancellationToken cancellationToken)
[Exception] Hybridisms.Server.WebApp.dll!Program.<Main>$(string[] args) Line 41
	at D:\GitHub\Hybridisms\Hybridisms.Server.WebApp\Program.cs(41)
System.Private.CoreLib.dll!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task)
System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task, System.Threading.Tasks.ConfigureAwaitOptions options)
[Waiting on Async Operation, double-click or press enter to view Async Call Stacks]
Hybridisms.Server.WebApp.dll!Program.<Main>(string[] args)

Regression

No response

Steps to reproduce

var db = builder.AddSqlite("db")
var web = builder.AddProject<Projects.Hybridisms_Server_WebApp>("webapp")
    .WithReference(db);

Expected behavior

No exception, or rather no extensions.

Screenshots

No response

IDE and version

VS 2022 Preview

IDE version

No response

Nuget packages


Additional context

No response

Help us help you

Yes, but only if others can assist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions