Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/Build/BackEnd/Components/Logging/LoggingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ private void RouteBuildEvent(object loggingEvent)
{
if (ShouldTreatWarningAsMessage(warningEvent))
{
loggingEvent = new BuildMessageEventArgs(
buildEventArgs = new BuildMessageEventArgs(
warningEvent.Subcategory,
warningEvent.Code,
warningEvent.File,
Expand All @@ -1458,7 +1458,7 @@ private void RouteBuildEvent(object loggingEvent)
}
else if (ShouldTreatWarningAsError(warningEvent))
{
loggingEvent = new BuildErrorEventArgs(
buildEventArgs = new BuildErrorEventArgs(
warningEvent.Subcategory,
warningEvent.Code,
warningEvent.File,
Expand All @@ -1477,26 +1477,32 @@ private void RouteBuildEvent(object loggingEvent)
}
}

if (loggingEvent is BuildErrorEventArgs errorEvent)
if (buildEventArgs is BuildErrorEventArgs errorEvent)
{
// Keep track of build submissions that have logged errors. If there is no build context, add BuildEventContext.InvalidSubmissionId.
_buildSubmissionIdsThatHaveLoggedErrors.Add(errorEvent.BuildEventContext?.SubmissionId ?? BuildEventContext.InvalidSubmissionId);
}

if (loggingEvent is ProjectFinishedEventArgs projectFinishedEvent && projectFinishedEvent.BuildEventContext != null)
if (buildEventArgs is ProjectFinishedEventArgs projectFinishedEvent && projectFinishedEvent.BuildEventContext != null)
{
int key = GetWarningsAsErrorOrMessageKey(projectFinishedEvent);
_warningsAsErrorsByProject?.Remove(key);
_warningsNotAsErrorsByProject?.Remove(key);
_warningsAsMessagesByProject?.Remove(key);
}

if (loggingEvent is BuildEventArgs loggingEventBuildArgs)
if (loggingEvent is BuildEventArgs)
{
RouteBuildEvent(loggingEventBuildArgs);
RouteBuildEvent(buildEventArgs);
}
else if (loggingEvent is KeyValuePair<int, BuildEventArgs> loggingEventKeyValuePair)
{
if (loggingEventKeyValuePair.Value != buildEventArgs)
{
// buildEventArgs has been altered, lets use that new one
loggingEventKeyValuePair = new KeyValuePair<int, BuildEventArgs>(loggingEventKeyValuePair.Key, buildEventArgs);
}

RouteBuildEvent(loggingEventKeyValuePair);
}
}
Expand Down