Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move into Shared for SqlConnectionString.cs #1329

Merged
merged 16 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs">
<Link>Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionString.cs">
<Link>Microsoft\Data\SqlClient\SqlConnectionString.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlCredential.cs">
<Link>Microsoft\Data\SqlClient\SqlCredential.cs</Link>
</Compile>
Expand Down Expand Up @@ -487,7 +490,6 @@
<ItemGroup Condition="'$(OSGroup)' != 'AnyOS' AND '$(TargetGroup)' == 'netcoreapp'">
<Compile Include="Microsoft\Data\ProviderBase\DbConnectionPool.NetCoreApp.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlAuthenticationProviderManager.NetCoreApp.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionString.NetCoreApp.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlDiagnosticListener.NetCoreApp.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlDelegatedTransaction.NetCoreApp.cs" />
<Compile Include="Microsoft\Data\SqlClient\TdsParser.NetCoreApp.cs" />
Expand Down Expand Up @@ -556,7 +558,6 @@
<Compile Include="Microsoft\Data\SqlClient\SqlConnection.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionFactory.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionHelper.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionString.cs" />
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs">
<Link>Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs</Link>
</Compile>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs">
<Link>Microsoft\Data\SqlClient\SqlConnectionPoolProviderInfo.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionString.cs">
<Link>Microsoft\Data\SqlClient\SqlConnectionString.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlDataAdapter.cs">
<Link>Microsoft\Data\SqlClient\SqlDataAdapter.cs</Link>
</Compile>
Expand Down Expand Up @@ -545,7 +548,6 @@
<Compile Include="Microsoft\Data\SqlClient\SqlConnection.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionFactory.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionHelper.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionString.cs" />
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs">
<Link>Microsoft\Data\SqlClient\SqlConnectionTimeoutErrorInternal.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ internal static class DbConnectionStringDefaults
internal const bool ContextConnection = false;
internal static readonly bool TransparentNetworkIPResolution = !LocalAppContextSwitches.DisableTNIRByDefault;
internal const string NetworkLibrary = "";
internal const bool Asynchronous = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed since Async is true by default now. But maybe we can remove it in a future PR since this one is already big.

#if ADONET_CERT_AUTH
internal const string Certificate = "";
#endif
Expand Down Expand Up @@ -982,7 +983,7 @@ internal static class DbConnectionStringDefaults
internal const int ConnectRetryCount = 1;
internal const int ConnectRetryInterval = 10;
internal static readonly SqlAuthenticationMethod Authentication = SqlAuthenticationMethod.NotSpecified;
internal static readonly SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Disabled;
internal const SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Disabled;
internal const string EnclaveAttestationUrl = "";
internal const SqlConnectionAttestationProtocol AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified;
internal const SqlConnectionIPAddressPreference IPAddressPreference = SqlConnectionIPAddressPreference.IPv4First;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void Constructor2_ConnectionString_Invalid()
// Keyword not supported: 'invalidkeyword'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'invalidkeyword'") != -1);
Assert.True(ex.Message.IndexOf("'invalidkeyword'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// invalid packet size (< minimum)
Expand Down Expand Up @@ -267,7 +267,7 @@ public void ConnectionString_Value_Invalid()
// Keyword not supported: 'invalidkeyword'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'invalidkeyword'") != -1);
Assert.True(ex.Message.IndexOf("'invalidkeyword'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);
}

Expand Down Expand Up @@ -468,7 +468,7 @@ public void ConnectionString_ConnectTimeout_Invalid()
// Invalid value for key 'connect timeout'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'connect timeout'") != -1);
Assert.True(ex.Message.IndexOf("'connect timeout'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// invalid number
Expand All @@ -477,7 +477,7 @@ public void ConnectionString_ConnectTimeout_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'connect timeout'") != -13);
Assert.True(ex.Message.IndexOf("'connect timeout'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Input string was not in a correct format
Expand All @@ -491,7 +491,7 @@ public void ConnectionString_ConnectTimeout_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'connect timeout'") != -1);
Assert.True(ex.Message.IndexOf("'connect timeout'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Value was either too large or too small for an Int32
Expand Down Expand Up @@ -526,7 +526,7 @@ public void ConnectionString_CommandTimeout_Invalid()
// Invalid value for key 'connect timeout'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'command timeout'") != -1);
Assert.True(ex.Message.IndexOf("'command timeout'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// invalid number
Expand All @@ -535,7 +535,7 @@ public void ConnectionString_CommandTimeout_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'command timeout'") != -13);
Assert.True(ex.Message.IndexOf("'command timeout'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Input string was not in a correct format
Expand All @@ -549,7 +549,7 @@ public void ConnectionString_CommandTimeout_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'command timeout'") != -1);
Assert.True(ex.Message.IndexOf("'command timeout'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Value was either too large or too small for an Int32
Expand Down Expand Up @@ -634,7 +634,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
// Invalid value for key 'max pool size'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// invalid number
Expand All @@ -643,7 +643,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Input string was not in a correct format
Expand All @@ -657,7 +657,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Value was either too large or too small for an Int32
Expand All @@ -670,7 +670,7 @@ public void ConnectionString_MaxPoolSize_Invalid()
// Invalid value for key 'max pool size'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'max pool size'") != -1);
Assert.True(ex.Message.IndexOf("'max pool size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// less than min pool size
Expand Down Expand Up @@ -702,7 +702,7 @@ public void ConnectionString_MinPoolSize_Invalid()
// Invalid value for key 'min pool size'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'min pool size'") != -1);
Assert.True(ex.Message.IndexOf("'min pool size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// invalid number
Expand All @@ -711,7 +711,7 @@ public void ConnectionString_MinPoolSize_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(FormatException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'min pool size'") != -1);
Assert.True(ex.Message.IndexOf("'min pool size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Input string was not in a correct format
Expand All @@ -725,7 +725,7 @@ public void ConnectionString_MinPoolSize_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'min pool size'") != -1);
Assert.True(ex.Message.IndexOf("'min pool size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Value was either too large or too small for an Int32
Expand All @@ -750,7 +750,7 @@ public void ConnectionString_MultipleActiveResultSets_Invalid()
// Invalid value for key 'multiple active result sets'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'multiple active result sets'") != -1);
Assert.True(ex.Message.IndexOf("'multiple active result sets'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);
}

Expand Down Expand Up @@ -781,7 +781,7 @@ public void ConnectionString_PacketSize_Invalid()
// integer >= 512 and <= 32768
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'Packet Size'") != -1);
Assert.True(ex.Message.IndexOf("'Packet Size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// invalid packet size (> maximum)
Expand All @@ -790,7 +790,7 @@ public void ConnectionString_PacketSize_Invalid()
// integer >= 512 and <= 32768
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'Packet Size'") != -1);
Assert.True(ex.Message.IndexOf("'Packet Size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// overflow
Expand All @@ -799,7 +799,7 @@ public void ConnectionString_PacketSize_Invalid()
Assert.NotNull(ex.InnerException);
Assert.Equal(typeof(OverflowException), ex.InnerException.GetType());
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'packet size'") != -1);
Assert.True(ex.Message.IndexOf("'packet size'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);

// Value was either too large or too small for an Int32
Expand Down Expand Up @@ -849,7 +849,7 @@ public void ConnectionString_UserInstance_Invalid()
// Invalid value for key 'user instance'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.True(ex.Message.IndexOf("'user instance'") != -1);
Assert.True(ex.Message.IndexOf("'user instance'", StringComparison.OrdinalIgnoreCase) != -1);
Assert.Null(ex.ParamName);
}

Expand Down Expand Up @@ -1009,7 +1009,7 @@ public void ConnectionString_IPAddressPreference_Invalid(string value)
// Invalid value for key 'ip address preference'
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
Assert.Contains("'ip address preference'", ex.Message);
Assert.Contains("'ip address preference'", ex.Message, StringComparison.OrdinalIgnoreCase);
Assert.Null(ex.ParamName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static void InvalidAuthTypeTest()
ArgumentException e = Assert.Throws<ArgumentException>(() => ConnectAndDisconnect(connStr));

string expectedMessage = "Invalid value for key 'authentication'.";
Assert.Contains(expectedMessage, e.Message);
Assert.Contains(expectedMessage, e.Message, StringComparison.OrdinalIgnoreCase);
}

[ConditionalFact(nameof(IsAADConnStringsSetup))]
Expand Down