diff --git a/src/BizHawk.Emulation.Common/Json/TypeConverterJsonAdapter.cs b/src/BizHawk.Emulation.Common/Json/TypeConverterJsonAdapter.cs index 75562c46d2d..21b10cb8522 100644 --- a/src/BizHawk.Emulation.Common/Json/TypeConverterJsonAdapter.cs +++ b/src/BizHawk.Emulation.Common/Json/TypeConverterJsonAdapter.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.ComponentModel; +using System.Globalization; using System.Linq; using System.Reflection; using System.Text.Json; @@ -17,14 +18,14 @@ public class TypeConverterJsonAdapter : JsonConverter public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var converter = TypeDescriptor.GetConverter(typeToConvert); - return (T)converter.ConvertFromString(reader.GetString())!; + return (T)converter.ConvertFromString(null!, CultureInfo.InvariantCulture, reader.GetString())!; } /// public override void Write(Utf8JsonWriter writer, T objectToWrite, JsonSerializerOptions options) { var converter = TypeDescriptor.GetConverter(objectToWrite!); - writer.WriteStringValue(converter.ConvertToString(objectToWrite!)); + writer.WriteStringValue(converter.ConvertToString(null!, CultureInfo.InvariantCulture, objectToWrite!)); } /// diff --git a/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs b/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs index 9e91c03e61a..c3a48731be1 100644 --- a/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs +++ b/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs @@ -124,7 +124,7 @@ public void TestSerializationTypeConverter() { var color = Color.FromArgb(200, 255, 13, 42); string serialized = JsonSerializer.Serialize(color, ConfigService.SerializerOptions); - Assert.AreEqual("\"200; 255; 13; 42\"", serialized); + Assert.AreEqual("\"200, 255, 13, 42\"", serialized); var newColor = JsonSerializer.Deserialize(serialized, ConfigService.SerializerOptions); Assert.AreEqual(color, newColor);