csredis icon indicating copy to clipboard operation
csredis copied to clipboard

Bug in BuildConnectionString Method

Open panditem opened this issue 10 months ago • 1 comments

The BuildConnectionString method in the RedisClientPool class has a bug when constructing the connection string. In line 117, a comma is missing before the user parameter, causing a runtime error. I fixed this issue locally by adding the necessary comma, resolving the bug.

ORIGINAL CODE

internal string BuildConnectionString(string endpoint) { return $"{endpoint}{(string.IsNullOrEmpty(_user) ? "" : $"user={_user}")},password={_password},defaultDatabase={_database},poolsize={PoolSize}," + $"connectTimeout={_connectTimeout},syncTimeout={_syncTimeout},idletimeout={(int)IdleTimeout.TotalMilliseconds}," + $"preheat=false,ssl={(_ssl ? "true" : "false")},tryit={_tryit},name={_clientname},prefix={Prefix}," + $"autodispose={(IsAutoDisposeWithSystem ? "true" : "false")},asyncpipeline={(_asyncPipeline ? "true" : "false")}"; }

FIXED CODE Connection Error

internal string BuildConnectionString(string endpoint) { return $"{endpoint}{(string.IsNullOrEmpty(_user) ? "" : $",user={_user}")},password={_password},defaultDatabase={_database},poolsize={PoolSize}," + $"connectTimeout={_connectTimeout},syncTimeout={_syncTimeout},idletimeout={(int)IdleTimeout.TotalMilliseconds}," + $"preheat=false,ssl={(_ssl ? "true" : "false")},tryit={_tryit},name={_clientname},prefix={Prefix}," + $"autodispose={(IsAutoDisposeWithSystem ? "true" : "false")},asyncpipeline={(_asyncPipeline ? "true" : "false")}"; }

panditem avatar Dec 30 '24 17:12 panditem