-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Pri2Indicates issues/PRs that are medium priorityIndicates issues/PRs that are medium priorityPri3Indicates issues/PRs that are low priorityIndicates issues/PRs that are low priorityarea-System.Data.SqlClientdoc-enhancementImprove the current contentImprove the current contenthelp wantedGood for community contributors to help [up-for-grabs]Good for community contributors to help [up-for-grabs]
Milestone
Description
If Application Name passed in is > 128 characters, SqlConnection constructor throws an exception. Interestingly, SqlConnectionStringBuilder class allows passing into it an Application Name > 128 characters.
var connectionString = $"Data Source=.;Initial Catalog=master;Integrated Security=true;Application Name={string.Join(string.Empty, Enumerable.Repeat("_", 129))}";
var connectionStringBuilder = new SqlConnectionStringBulder(connectionString);
using (var sqlConn = new SqlConnection(connectionStringBuilder.ToString())
{
}
Error message:
The value's length for key 'application name' exceeds it's limit of '128'.
Stack trace:
at System.Data.SqlClient.SqlConnectionString.ValidateValueLength(String value, Int32 limit, String key)
at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
at System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)
at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
at UserQuery.RunUserAuthoredQuery() in C:\Users\john.zabroski\AppData\Local\Temp\LINQPad5\_pogoghlc\query_fnlgxf.cs:line 35
at LINQPad.ExecutionModel.ClrQueryRunner.Run()
at LINQPad.ExecutionModel.Server.RunQuery(QueryRunner runner)
at LINQPad.ExecutionModel.Server.StartQuery(QueryRunner runner)
at LINQPad.ExecutionModel.Server.<>c__DisplayClass153_0.<ExecuteClrQuery>b__0()
at LINQPad.ExecutionModel.Server.SingleThreadExecuter.Work()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Metadata
Metadata
Assignees
Labels
Pri2Indicates issues/PRs that are medium priorityIndicates issues/PRs that are medium priorityPri3Indicates issues/PRs that are low priorityIndicates issues/PRs that are low priorityarea-System.Data.SqlClientdoc-enhancementImprove the current contentImprove the current contenthelp wantedGood for community contributors to help [up-for-grabs]Good for community contributors to help [up-for-grabs]