diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs index afe86bd0..0ace6c92 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs @@ -358,20 +358,22 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection return false; } - // Send a telemetry notification for intellisense performance metrics - ServiceHost.SendEvent(TelemetryNotification.Type, new TelemetryParams() + if (ServiceHost != null) { - Params = new TelemetryProperties + // Send a telemetry notification for intellisense performance metrics + ServiceHost.SendEvent(TelemetryNotification.Type, new TelemetryParams() { - Properties = new Dictionary + Params = new TelemetryProperties + { + Properties = new Dictionary { { "IsAzure", info.IsAzure ? "1" : "0" } }, - EventName = TelemetryEventNames.IntellisenseQuantile, - Measures = info.IntellisenseMetrics.Quantile - } - }); - + EventName = TelemetryEventNames.IntellisenseQuantile, + Measures = info.IntellisenseMetrics.Quantile + } + }); + } // Close the connection info.SqlConnection.Close();