Skip to content

Commit fd981da

Browse files
authored
Fixed CA1873 warning (#4479)
1 parent b2ad1c3 commit fd981da

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,15 @@ private void UpdateSessionConversationId(ChatClientAgentSession session, string?
747747
{
748748
// The agent has a ChatHistoryProvider configured, but the service returned a conversation id,
749749
// meaning the service manages chat history server-side. Both cannot be used simultaneously.
750-
if (this._agentOptions?.WarnOnChatHistoryProviderConflict is true)
750+
if (this._agentOptions?.WarnOnChatHistoryProviderConflict is true
751+
&& this._logger.IsEnabled(LogLevel.Warning))
751752
{
752-
this._logger.LogAgentChatClientHistoryProviderConflict(nameof(ChatClientAgentSession.ConversationId), nameof(this.ChatHistoryProvider), this.Id, this.GetLoggingAgentName());
753+
var loggingAgentName = this.GetLoggingAgentName();
754+
this._logger.LogAgentChatClientHistoryProviderConflict(
755+
nameof(ChatClientAgentSession.ConversationId),
756+
nameof(this.ChatHistoryProvider),
757+
this.Id,
758+
loggingAgentName);
753759
}
754760

755761
if (this._agentOptions?.ThrowOnChatHistoryProviderConflict is true)

0 commit comments

Comments
 (0)