Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Use InvariantCulture to convert property values #144

Merged
merged 1 commit into from
Jan 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Microsoft.ApplicationInsights.DiagnosticSourceListener
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Microsoft.ApplicationInsights.DataContracts;

internal class DiagnosticSourceListenerSubscription : IObserver<KeyValuePair<string, object>>
Expand Down Expand Up @@ -58,7 +59,7 @@ public void OnNext(KeyValuePair<string, object> @event)
{
if (!property.IsSpecialName)
{
telemetry.Properties.Add(property.Name, Convert.ToString(property.GetValue(payload)));
telemetry.Properties.Add(property.Name, Convert.ToString(property.GetValue(payload), CultureInfo.InvariantCulture));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void HandlesPropertiesWithNullValues()

TraceTelemetry telemetry = (TraceTelemetry)this.adapterHelper.Channel.SentItems.First();
Assert.AreEqual("Hey!", telemetry.Message);
Assert.AreEqual(Convert.ToString(null), telemetry.Properties["Prop1"]);
Assert.AreEqual(string.Empty, telemetry.Properties["Prop1"]);
}
}

Expand Down