Skip to content

[Bug]: error MSB4017 is not shown consistently when the internal logger exception occurs. #9455

@AR-May

Description

@AR-May

Issue Description

The MSB4017 error is not consistently shown when a logger fails.

Steps to Reproduce

  1. Update the BuildStartedHandler of ParallelConsoleLogger such that it thows an exception. For example, add a throw in that line.
  2. Run a build of some project. Console app will do. You will see the message along with details: stack trace and exception message.
MSBUILD : error MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
This is an unhandled exception from a logger -- PLEASE OPEN A BUG AGAINST THE LOGGER OWNER.
  1. Remove the previous code change and update instead the ProjectStartedHandler of ParallelConsoleLogger with some throw (this line).
  2. Run build again. You will see only
MSBuild version 17.9.0-dev-23574-01+f4b2350ac for .NET Framework
Build started 11/24/2023 3:59:10 PM.

Expected Behavior

I expect to see the error MSB4017 for any logger failure.

Actual Behavior

No error MSB4017 in the second build. The log does not indicate anything about what happened and is confusing.

Analysis

Here is the place where the error was considered benign, and the exception is not thrown up further:

if (ExceptionHandling.IsCriticalException(ex))

Since customers may write their own logs, including ones that throw exceptions during events handlers, I would suggest address all exceptions that the loggers throw and, in all times, report the logger failure.

Versions & Configurations

No response

Metadata

Metadata

Assignees

Labels

Priority:2Work that is important, but not critical for the releasebugtriaged

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions