From 3669e5f4de6ef9a43ca45e071e8c6a513d4111f9 Mon Sep 17 00:00:00 2001 From: WolfspiritM Date: Thu, 28 Jul 2016 19:49:15 +0200 Subject: [PATCH] Fix invalid JSON caused by localized decimal mark Using InvariantCulture to convert the double to string to generate a dot instead of a comma. --- src/Glimpse.Common/Internal/Serialization/TimeSpanConverter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Glimpse.Common/Internal/Serialization/TimeSpanConverter.cs b/src/Glimpse.Common/Internal/Serialization/TimeSpanConverter.cs index a9bf7288..f4c2c206 100644 --- a/src/Glimpse.Common/Internal/Serialization/TimeSpanConverter.cs +++ b/src/Glimpse.Common/Internal/Serialization/TimeSpanConverter.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using Newtonsoft.Json; namespace Glimpse.Internal @@ -15,7 +16,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s result = Math.Round(convertedNullable.Value.TotalMilliseconds, 2); } - writer.WriteRawValue(result.ToString()); + writer.WriteRawValue(result.ToString(CultureInfo.InvariantCulture)); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)