Skip to content

Log exception details from MSBuildLogger - #17423

Merged
akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:akoeplinger/log-msbuildlogger-exceptions
Aug 27, 2026
Merged

akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:akoeplinger/log-msbuildlogger-exceptions

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

The standard Microsoft.Extensions.Logging formatter does not include the exception in the formatted message. Append the exception when forwarding logs to MSBuild so the exception type, message, and stack trace are visible in build output.

Append exception details to messages forwarded from Microsoft.Extensions.Logging so MSBuild output includes the exception type, message, and stack trace.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: b9317408-5bfc-493f-97cd-c3d8ba4d032c
Copilot AI lite review requested due to automatic review settings August 27, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves build output diagnostics by ensuring exception details (type, message, stack trace) are included when Microsoft.Extensions.Logging messages are forwarded into MSBuild logging, where the default formatter may omit exceptions.

Changes:

  • Append exception.ToString() to the formatted log message when an exception is present.
  • Preserve existing MSBuild severity mapping for LogLevel to TaskLoggingHelper calls.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@akoeplinger
akoeplinger enabled auto-merge (squash) August 27, 2026 08:36
@akoeplinger
akoeplinger merged commit cbec6b7 into dotnet:main Aug 27, 2026
9 of 12 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 28, 2026
@akoeplinger
akoeplinger deleted the akoeplinger/log-msbuildlogger-exceptions branch August 28, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants