Commit 86c0fa81 authored by Marc Gravell's avatar Marc Gravell

swap int.TryParse => Format.TryParse just in case #883 is locale-related

parent d6653d3b
......@@ -245,7 +245,7 @@ internal static EndPoint TryParseEndPoint(string addressWithPort)
int? port = 0;
if (portPart != null)
{
if (int.TryParse(portPart, out var portVal))
if (Format.TryParseInt32(portPart, out var portVal))
{
port = portVal;
}
......
......@@ -1916,7 +1916,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
{
return true;
}
else if (arr.Length == 2 && int.TryParse(arr[1], out var port))
else if (arr.Length == 2 && Format.TryParseInt32(arr[1], out var port))
{
SetResult(message, Format.ParseEndPoint(arr[0], port));
return true;
......
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
......@@ -331,6 +332,16 @@ private void Check(string name, object x, object y)
[Fact]
public void Issue883_Exhaustive()
{
var old = CultureInfo.CurrentCulture;
try
{
var all = CultureInfo.GetCultures(CultureTypes.AllCultures);
Writer.WriteLine($"Checking {all.Length} cultures...");
foreach (var ci in all)
{
Writer.WriteLine("Tessting: " + ci.Name);
CultureInfo.CurrentCulture = ci;
var a = ConnectionMultiplexer.PrepareConfig("myDNS:883,password=mypassword,connectRetry=3,connectTimeout=5000,syncTimeout=5000,defaultDatabase=0,ssl=true,abortConnect=false");
var b = ConnectionMultiplexer.PrepareConfig(new ConfigurationOptions
{
......@@ -360,6 +371,12 @@ public void Issue883_Exhaustive()
Check(field.Name, field.GetValue(a), field.GetValue(b));
}
}
}
finally
{
CultureInfo.CurrentCulture = old;
}
}
[Fact]
public void SSLParseViaConfig_Issue883_ConfigObject()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment