diff --git a/shell/agents/Microsoft.Azure.Agent/ChatSession.cs b/shell/agents/Microsoft.Azure.Agent/ChatSession.cs index afe88f15..c0156903 100644 --- a/shell/agents/Microsoft.Azure.Agent/ChatSession.cs +++ b/shell/agents/Microsoft.Azure.Agent/ChatSession.cs @@ -132,8 +132,9 @@ private async Task SetupNewChat(IStatusContext context, CancellationToke } catch (Exception e) { - if (e is not OperationCanceledException and TokenRequestException) + if (e is not OperationCanceledException and not TokenRequestException) { + // Trace a telemetry for any unexpected error. Telemetry.Trace(AzTrace.Exception("Failed to setup a new chat session."), e); }