From 096381d1c345a0fdc498ad44a964b196dca644fa Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 13 May 2026 19:08:19 +0000
Subject: [PATCH] Normalize edge helper bad input validation
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>
---
.../WorkflowBuilderExtensions.cs | 34 ++++++++++---------
.../WorkflowBuilderSmokeTests.cs | 4 +--
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs
index f9c3e2056a..b09dec91f4 100644
--- a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs
+++ b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowBuilderExtensions.cs
@@ -25,7 +25,11 @@ public static class WorkflowBuilderExtensions
/// The target executor to which messages will be forwarded.
/// The updated instance.
public static WorkflowBuilder ForwardMessage(this WorkflowBuilder builder, ExecutorBinding source, ExecutorBinding target)
- => builder.ForwardMessage(source, [target], condition: null);
+ {
+ Throw.IfNull(target);
+
+ return builder.ForwardMessage(source, [target], condition: null);
+ }
///
/// Adds edges to the workflow that forward messages of the specified type from the source executor to
@@ -57,17 +61,14 @@ public static class WorkflowBuilderExtensions
Throw.IfNull(targets);
Func