From 2392255f9f3c173a0a17a69cbbf9fc836f767a83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 12:58:35 +0000 Subject: [PATCH] Add comment explaining unusual Throw.IfNull use for null elements inside collection Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/c5655707-5b0b-44f3-98a9-5f3961e32cfe Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com> --- dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs index bee9947a6b..66ac3e6908 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs @@ -40,6 +40,7 @@ public sealed class SwitchBuilder foreach (ExecutorBinding executor in executors) { + // Explicit name: null element inside the collection argument. Throw.IfNull(executor, $"{nameof(executors)}[{executorIndex++}]"); if (!this._executorIndicies.TryGetValue(executor.Id, out int index)) @@ -71,6 +72,7 @@ public sealed class SwitchBuilder foreach (ExecutorBinding executor in executors) { + // Explicit name: null element inside the collection argument. Throw.IfNull(executor, $"{nameof(executors)}[{executorIndex++}]"); if (!this._executorIndicies.TryGetValue(executor.Id, out int index))