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