Skip to content

Allow null connection string to be passed to UseProvider methods #26869

@dotdiego

Description

@dotdiego

After using a workaround to handle #25555 (using a --Configuration Bundle during generation)

I'm faced with another bug when trying to apply the bundle.

When i'm using

./bundle.exe --connection "Server=(localdb)\\mssqllocaldb;Database=MyAppDb;Trusted_Connection=true;"

Case : there are no appsettings.json or none with a correct connectionString in the same folder as bundle.exe

Value cannot be null. (Parameter 'connectionString')

It's like the bundle.exe doesn't even look at the parameter connection because there are no connectionString in appsettings.json.

Case : appsettings.json with a correct connectionString exists and use the --connection parameter

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SNI_PN11, error: 50 - Local Database Runtime error occurred. The instance name of the local database specified is not valid.

Last sentence of the error is translated, because it was originally in french.

Yet when i put the same connection string in an appSettings.json it works perfectly and doesn't trigger this network-related error.

Include provider and version information

EF Core version: 6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6
Operating system: W10
IDE: VS 2022
dotnet-ef tools : 6.0.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions