diff --git a/src/System.CommandLine/Invocation/InvocationPipeline.cs b/src/System.CommandLine/Invocation/InvocationPipeline.cs index 6727a927b8..4ef969781d 100644 --- a/src/System.CommandLine/Invocation/InvocationPipeline.cs +++ b/src/System.CommandLine/Invocation/InvocationPipeline.cs @@ -126,6 +126,10 @@ internal static int Invoke(ParseResult parseResult) private static int DefaultExceptionHandler(Exception exception, CliConfiguration config) { + if (exception is AggregateException aggregateException && aggregateException.InnerExceptions.Count == 1) + { + exception = aggregateException.InnerExceptions[0]; + } if (exception is not OperationCanceledException) { ConsoleHelpers.ResetTerminalForegroundColor();