Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: resolve CA1873 in GitHubCopilotAgent by using LoggerMessage sour…
…ce generator

Replace the direct logger.LogWarning() call (which eagerly evaluates
string.Join()) with a [LoggerMessage]-generated extension method in
GitHubCopilotAgentLogMessages.cs.

Fixes build error:
  GitHubCopilotAgent.cs(580,13): error CA1873: Evaluation of this argument
  may be expensive and unnecessary if logging is disabled

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
alliscode and Copilot committed Jun 30, 2026
commit 725e72964a36142d698a52b57c2af0a3f7c94b1a
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,13 @@ private AgentResponseUpdate ConvertToAgentResponseUpdate(SessionEvent sessionEve
// Warn so the developer knows the ApprovalRequiredAIFunction marker(s) will not be automatically gated.
if (sessionConfig.Hooks?.OnPreToolUse is not null)
{
logger.LogApprovalGatingSkippedDueToCustomHook(
approvalRequiredToolNames.Count,
string.Join(", ", approvalRequiredToolNames));
if (logger.IsEnabled(LogLevel.Warning))
{
logger.LogApprovalGatingSkippedDueToCustomHook(
approvalRequiredToolNames.Count,
string.Join(", ", approvalRequiredToolNames));
}

return sessionConfig;
}

Expand Down
Loading