From d12579ec6690c297b47fb2778845130433aa189b Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 13 May 2026 19:06:14 +0000
Subject: [PATCH] Strengthen workflow edge helper tests
Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/af831ee2-0a99-4427-9ffd-a3b5022c1b3b
Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
---
.../SwitchBuilder.cs | 4 +
.../WorkflowBuilderExtensions.cs | 5 +
.../WorkflowBuilderSmokeTests.cs | 121 +++++++++++++++++-
3 files changed, 126 insertions(+), 4 deletions(-)
diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs
index 14e6ed4f7c..286329b6ec 100644
--- a/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs
+++ b/dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs
@@ -39,6 +39,8 @@ public sealed class SwitchBuilder
foreach (ExecutorBinding executor in executors)
{
+ Throw.IfNull(executor, nameof(executors));
+
if (!this._executorIndicies.TryGetValue(executor.Id, out int index))
{
index = this._executors.Count;
@@ -66,6 +68,8 @@ public sealed class SwitchBuilder
foreach (ExecutorBinding executor in executors)
{
+ Throw.IfNull(executor, nameof(executors));
+
if (!this._executorIndicies.TryGetValue(executor.Id, out int index))
{
index = this._executors.Count;
diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs
index c702cf9ece..f9c3e2056a 100644
--- a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs
+++ b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs
@@ -52,6 +52,8 @@ public static class WorkflowBuilderExtensions
/// The updated instance.
public static WorkflowBuilder ForwardMessage(this WorkflowBuilder builder, ExecutorBinding source, IEnumerable targets, Func? condition = null)
{
+ Throw.IfNull(builder);
+ Throw.IfNull(source);
Throw.IfNull(targets);
Func