Hello!
I'm having an issue when calling ConfigurationOptions.ToString method, when my connection string has an IPv6 address.
Just for some context, I'm using Redis as a backplane for SignalR and I parse my original connection string to enhance it. Then, I convert it back to string to pass it to RedisScaleoutConfiguration (Microsoft.AspNet.SignalR.StackExchangeRedis@2.4.3 - I'm using .Net Framework 4.8).
That's why I need to use ConfigurationOptions.ToString method, and I'd expect my connection string IPv6 address to have brackets added to it.
The following example reproduces the behavior:
var connectionString = "[::1]:6379,password=mypass";
var configuration = ConfigurationOptions.Parse(connectionString);
configuration.AbortOnConnectFail = false;
configuration.ClientName = "my-client-name";
var converted = configuration.ToString();
Console.WriteLine(converted); //expected [::1]:6379, actual: ::1:6379
var endpoint = configuration.EndPoints.FirstOrDefault().ToString();
Console.WriteLine(endpoint); //EndPoint.ToString method correctly adds the brackets
From my observation, the ConfigurationOptions.ToString method writes the endpoints using Format class, which directly writes the IP address without checking if that's an IPv6 address.
Hello!
I'm having an issue when calling
ConfigurationOptions.ToStringmethod, when my connection string has an IPv6 address.Just for some context, I'm using Redis as a backplane for SignalR and I parse my original connection string to enhance it. Then, I convert it back to string to pass it to
RedisScaleoutConfiguration(Microsoft.AspNet.SignalR.StackExchangeRedis@2.4.3- I'm using .Net Framework 4.8).That's why I need to use
ConfigurationOptions.ToStringmethod, and I'd expect my connection string IPv6 address to have brackets added to it.The following example reproduces the behavior:
From my observation, the
ConfigurationOptions.ToStringmethod writes the endpoints usingFormatclass, which directly writes the IP address without checking if that's an IPv6 address.