in src/Telemetry/Telemetry.cs [125:148]
public void TrackException(TelemetryErrorName errorName, Exception exception, IDictionary<TelemetryPropertyName, string> properties = null,
IDictionary<TelemetryMeasureName, double> measurements = null)
{
try
{
if (!this._initialized || !this.Enabled)
{
return;
}
this._logger.LogTrace($"Sending exception event: {exception.Message}");
properties = properties != null ? new Dictionary<TelemetryPropertyName, string>(properties) : new Dictionary<TelemetryPropertyName, string>();
properties[TelemetryPropertyName.ErrorName] = errorName.ToString();
properties[TelemetryPropertyName.ErrorCode] = ExtractErrorCode(exception);
//continue task in existing parallel thread
this._trackEventTask = this._trackEventTask.ContinueWith(
x => this.TrackExceptionTask(exception, properties, measurements)
);
}
catch (Exception ex)
{
// We don't want errors sending telemetry to break the app, so just log and move on
this._logger.LogError($"Error sending exception event. Message={ex.Message}");
}
}