When creating IncrementingEventCounter (https://github.com/dotnet/corefx/blob/61a6264018989e06d314b68d57bd91b4b72e4360/src/Common/src/CoreLib/System/Diagnostics/Tracing/IncrementingEventCounter.cs) without setting the DisplayRateTimeScale property, the property value will remain the default TimeSpan.Zero.
While dumping the value to the EventSource using the DiagnosticCounter.WritePayload method, this will be converted into string.Emtpy:
payload.DisplayRateTimeScale = (DisplayRateTimeScale == TimeSpan.Zero) ? "" : DisplayRateTimeScale.ToString("c")
(https://github.com/dotnet/corefx/blob/61a6264018989e06d314b68d57bd91b4b72e4360/src/Common/src/CoreLib/System/Diagnostics/Tracing/IncrementingEventCounter.cs#L66)
But in the dotnet-counters the IncrementingCounterPayload constructor doesn't handle this case of empty string:
|
m_DisplayRateTimeScale = TimeSpan.Parse(payloadFields["DisplayRateTimeScale"].ToString()).ToString("%s' sec'"); |
which will cause a
System.FormatException to be thrown

When creating
IncrementingEventCounter(https://github.com/dotnet/corefx/blob/61a6264018989e06d314b68d57bd91b4b72e4360/src/Common/src/CoreLib/System/Diagnostics/Tracing/IncrementingEventCounter.cs) without setting theDisplayRateTimeScaleproperty, the property value will remain the defaultTimeSpan.Zero.While dumping the value to the
EventSourceusing theDiagnosticCounter.WritePayloadmethod, this will be converted intostring.Emtpy:payload.DisplayRateTimeScale = (DisplayRateTimeScale == TimeSpan.Zero) ? "" : DisplayRateTimeScale.ToString("c")(https://github.com/dotnet/corefx/blob/61a6264018989e06d314b68d57bd91b4b72e4360/src/Common/src/CoreLib/System/Diagnostics/Tracing/IncrementingEventCounter.cs#L66)
But in the dotnet-counters the
IncrementingCounterPayloadconstructor doesn't handle this case of empty string:diagnostics/src/Tools/dotnet-counters/CounterPayload.cs
Line 58 in 26d292c
which will cause a
System.FormatExceptionto be thrown