-
Notifications
You must be signed in to change notification settings - Fork 316
Description
Version: Microsoft.Data.SqlClient 2.0.0; .net47 (NuGet)
If i set MARS on Microsoft.Data.SqlConnectionstringBuilder to true then property ConnectionString will return "Multiple Active Result Sets=true;" which is wrong - there are spaces, it should be "MultipleActiveResultSets=true;" (see https://docs.microsoft.com/en/dotnet/framework/data/adonet/sql/enabling-multiple-active-result-sets, https://www.sqlteam.com/articles/multiple-active-result-sets-mars, https://www.connectionstrings.com/microsoft-data-sqlclient/enable-mars/ etc)
Packages.config (fresh console project with Microsoft.Data.SqlClient nuget):
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Data.SqlClient" version="2.0.0" targetFramework="net47" />
<package id="Microsoft.Data.SqlClient.SNI" version="2.0.0" targetFramework="net47" />
<package id="Microsoft.Identity.Client" version="4.14.0" targetFramework="net47" />
<package id="Microsoft.IdentityModel.JsonWebTokens" version="5.6.0" targetFramework="net47" />
<package id="Microsoft.IdentityModel.Logging" version="5.6.0" targetFramework="net47" />
<package id="Microsoft.IdentityModel.Protocols" version="5.6.0" targetFramework="net47" />
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.6.0" targetFramework="net47" />
<package id="Microsoft.IdentityModel.Tokens" version="5.6.0" targetFramework="net47" />
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net47" />
<package id="System.IdentityModel.Tokens.Jwt" version="5.6.0" targetFramework="net47" />
</packages>
Issue reproduction:
var cb = new Microsoft.Data.SqlClient.SqlConnectionStringBuilder();
cb.MultipleActiveResultSets = true;
Console.WriteLine(cb.ConnectionString);
// "Multiple Active Result Sets=True" - wrong. Should be "MultipleActiveResultSets=True;"or
(connection string is from https://www.connectionstrings.com/microsoft-data-sqlclient/enable-mars/)
var cb = new Microsoft.Data.SqlClient.SqlConnectionStringBuilder("Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;MultipleActiveResultSets=true;");
Console.WriteLine(cb.ConnectionString);
// "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;Multiple Active Result Sets=true;
// wrong. Should be "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;MultipleActiveResultSets=True;" - i send that to constructor.Can post you repro, but its really just these few lines of code.
Workaround:
a) Dont update to 2.0.0 :)
b) just cb.ConnectionString.Replace("Multiple Active Result Sets", "MultipleActiveResultSets");