From 61fc80178fe6026668026dc7d9c933c134a1d447 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:42:33 +0000 Subject: [PATCH] Fix if/else if consistency for error event handlers per code review feedback Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/c5d77400-d7ed-4fbe-9103-f5d74aabcf2b Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com> --- .../Checkpoint/CheckpointAndRehydrate/Program.cs | 6 ++---- .../03-workflows/Checkpoint/CheckpointAndResume/Program.cs | 6 ++---- .../ConditionalEdges/03_MultiSelection/Program.cs | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dotnet/samples/03-workflows/Checkpoint/CheckpointAndRehydrate/Program.cs b/dotnet/samples/03-workflows/Checkpoint/CheckpointAndRehydrate/Program.cs index e2b4a25036..49752e256d 100644 --- a/dotnet/samples/03-workflows/Checkpoint/CheckpointAndRehydrate/Program.cs +++ b/dotnet/samples/03-workflows/Checkpoint/CheckpointAndRehydrate/Program.cs @@ -65,8 +65,7 @@ public static class Program Console.Error.WriteLine(workflowError.Exception?.ToString() ?? "Unknown workflow error occurred."); Console.ResetColor(); } - - if (evt is ExecutorFailedEvent executorFailed) + else if (evt is ExecutorFailedEvent executorFailed) { Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine($"Executor '{executorFailed.ExecutorId}' failed with {(executorFailed.Data == null ? "unknown error" : $"exception {executorFailed.Data}")}."); @@ -107,8 +106,7 @@ public static class Program Console.Error.WriteLine(workflowError.Exception?.ToString() ?? "Unknown workflow error occurred."); Console.ResetColor(); } - - if (evt is ExecutorFailedEvent executorFailed) + else if (evt is ExecutorFailedEvent executorFailed) { Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine($"Executor '{executorFailed.ExecutorId}' failed with {(executorFailed.Data == null ? "unknown error" : $"exception {executorFailed.Data}")}."); diff --git a/dotnet/samples/03-workflows/Checkpoint/CheckpointAndResume/Program.cs b/dotnet/samples/03-workflows/Checkpoint/CheckpointAndResume/Program.cs index 5dcf524dc6..510fb9f345 100644 --- a/dotnet/samples/03-workflows/Checkpoint/CheckpointAndResume/Program.cs +++ b/dotnet/samples/03-workflows/Checkpoint/CheckpointAndResume/Program.cs @@ -62,8 +62,7 @@ public static class Program Console.Error.WriteLine(workflowError.Exception?.ToString() ?? "Unknown workflow error occurred."); Console.ResetColor(); } - - if (evt is ExecutorFailedEvent executorFailed) + else if (evt is ExecutorFailedEvent executorFailed) { Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine($"Executor '{executorFailed.ExecutorId}' failed with {(executorFailed.Data == null ? "unknown error" : $"exception {executorFailed.Data}")}."); @@ -101,8 +100,7 @@ public static class Program Console.Error.WriteLine(workflowError.Exception?.ToString() ?? "Unknown workflow error occurred."); Console.ResetColor(); } - - if (evt is ExecutorFailedEvent executorFailed) + else if (evt is ExecutorFailedEvent executorFailed) { Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine($"Executor '{executorFailed.ExecutorId}' failed with {(executorFailed.Data == null ? "unknown error" : $"exception {executorFailed.Data}")}."); diff --git a/dotnet/samples/03-workflows/ConditionalEdges/03_MultiSelection/Program.cs b/dotnet/samples/03-workflows/ConditionalEdges/03_MultiSelection/Program.cs index f74a1aabe0..6eac1cbcd9 100644 --- a/dotnet/samples/03-workflows/ConditionalEdges/03_MultiSelection/Program.cs +++ b/dotnet/samples/03-workflows/ConditionalEdges/03_MultiSelection/Program.cs @@ -105,8 +105,7 @@ public static class Program Console.Error.WriteLine(workflowError.Exception?.ToString() ?? "Unknown workflow error occurred."); Console.ResetColor(); } - - if (evt is ExecutorFailedEvent executorFailed) + else if (evt is ExecutorFailedEvent executorFailed) { Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine($"Executor '{executorFailed.ExecutorId}' failed with {(executorFailed.Data == null ? "unknown error" : $"exception {executorFailed.Data}")}.");