From 802890aefe6c2b8397644a37e38ed81c73f3ed05 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Mon, 3 Feb 2025 15:31:05 -0800 Subject: [PATCH] Ensure we log exception text when an exception is given The formatter passed doesn't include it (despite that the exception is passed to it) so we must append it ourselves. --- .../MSBuild/Core/MSBuild/DiagnosticReporterLoggerProvider.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Workspaces/MSBuild/Core/MSBuild/DiagnosticReporterLoggerProvider.cs b/src/Workspaces/MSBuild/Core/MSBuild/DiagnosticReporterLoggerProvider.cs index 2f3feaa431f28..5f3ccc2bb87e6 100644 --- a/src/Workspaces/MSBuild/Core/MSBuild/DiagnosticReporterLoggerProvider.cs +++ b/src/Workspaces/MSBuild/Core/MSBuild/DiagnosticReporterLoggerProvider.cs @@ -52,6 +52,10 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except if (!string.IsNullOrEmpty(categoryName)) message = $"[{categoryName}] {message}"; + // The standard formatters don't actually include the exception, so let's include it ourselves + if (exception is not null) + message += Environment.NewLine + exception.ToString(); + reporter.Report(new WorkspaceDiagnostic(kind, message)); } }