private static void PublishTelemetryEventAsync(IAutoUpdate autoUpdate, Stopwatch updateOptionStopwatch, bool timeOutOccurred) { Task.Run(() => { try { var updateOption = autoUpdate.UpdateOptionAsync.Result; if (timeOutOccurred) { updateOptionStopwatch.Stop(); } Logger.PublishTelemetryEvent(TelemetryEventFactory.ForGetUpgradeOption(autoUpdate.GetInitializationTime(), updateOptionStopwatch.Elapsed, updateOption.ToString(), timeOutOccurred)); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) { e.ReportException(); System.Diagnostics.Trace.WriteLine($"Unable to send telemetry at {e.Message}"); } #pragma warning restore CA1031 // Do not catch general exception types }); }
private static void PublishTelemetryEventAsync(IAutoUpdate autoUpdate, Stopwatch updateOptionStopwatch, bool timeOutOccurred) { Task.Run(() => { try { var updateOption = autoUpdate.UpdateOptionAsync.Result; if (timeOutOccurred) { updateOptionStopwatch.Stop(); } Logger.PublishTelemetryEvent(TelemetryAction.Upgrade_GetUpgradeOption, new Dictionary <TelemetryProperty, string> { { TelemetryProperty.UpdateInitializationTime, GetTimeSpanTelemetryString(autoUpdate.GetInitializationTime()) }, { TelemetryProperty.UpdateOptionWaitTime, GetTimeSpanTelemetryString(updateOptionStopwatch.Elapsed) }, { TelemetryProperty.UpdateOption, updateOption.ToString() }, { TelemetryProperty.UpdateTimedOut, timeOutOccurred.ToString(CultureInfo.InvariantCulture) } }); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) { e.ReportException(); System.Diagnostics.Trace.WriteLine($"Unable to send telemetry at {e.Message}"); } #pragma warning restore CA1031 // Do not catch general exception types }); }