dotnet / dotnet/msbuild

Logger error should be reported to other loggers

Open
#6,564 1 comment 0 reactions 0 assignees View on GitHub
Area: Logging needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Have two loggers: /bl and a misbehaving logger that throws on, say, ProjectStarted.

The build will fail with 0 errors, 0 warnings and this message:

```
Build FAILED.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:05.94
MSBUILD : error MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
Microsoft.Build.Exceptions.InternalLoggerException: The build stopped unexpectedly because of an unexpected logger failure. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at MSBuild.Logger.BuildConfiguration.Equals(Object obj)
at System.Collections.Generic.ObjectEqualityComparer`1.Equals(T x, T y)
at System.Collections.Generic.List`1.Contains(T item)
at MSBuild.Logger.ProjectTrees.AddTopLevelProject(ProjectStartedEventArgs startedEvent, BuildConfiguration platformConfiguration)
at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseProjectStartedEvent(Object sender, ProjectStartedEventArgs buildEvent)
--- End of inner exception stack trace ---
at Microsoft.Build.Exceptions.InternalLoggerException.Throw(Exception innerException, BuildEventArgs e, String messageResourceName, Boolean initializationException, String[] messageArgs)
at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseProjectStartedEvent(Object sender, ProjectStartedEventArgs buildEvent)
at MSBuild.Logger.ForwardingLogger.ForwardEvent(Object sender, BuildEventArgs e)
at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseProjectStartedEvent(Object sender, ProjectStartedEventArgs buildEvent)
```

This message is missing from the binlog, so we should probably have a better design around continuing to log into other loggers when one logger crashes. Right now the binlog just contains build failed but no indication of the other logger fault.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.