Skip to content

Commit 265f341

Browse files
authored
Fix treating log messages from Node same as direct messages (#8954)
Fixes #8814 Context Messages coming from Nodes were handled differently than direct messages, for failing builds purposes. Changes Made Treating log messages from Node same as direct messages Testing Cant repro the local repro after changes Notes
1 parent 68d3eea commit 265f341

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Build/BackEnd/Components/Logging/LoggingService.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ private void RouteBuildEvent(object loggingEvent)
14381438
{
14391439
if (ShouldTreatWarningAsMessage(warningEvent))
14401440
{
1441-
loggingEvent = new BuildMessageEventArgs(
1441+
buildEventArgs = new BuildMessageEventArgs(
14421442
warningEvent.Subcategory,
14431443
warningEvent.Code,
14441444
warningEvent.File,
@@ -1458,7 +1458,7 @@ private void RouteBuildEvent(object loggingEvent)
14581458
}
14591459
else if (ShouldTreatWarningAsError(warningEvent))
14601460
{
1461-
loggingEvent = new BuildErrorEventArgs(
1461+
buildEventArgs = new BuildErrorEventArgs(
14621462
warningEvent.Subcategory,
14631463
warningEvent.Code,
14641464
warningEvent.File,
@@ -1477,26 +1477,32 @@ private void RouteBuildEvent(object loggingEvent)
14771477
}
14781478
}
14791479

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

1486-
if (loggingEvent is ProjectFinishedEventArgs projectFinishedEvent && projectFinishedEvent.BuildEventContext != null)
1486+
if (buildEventArgs is ProjectFinishedEventArgs projectFinishedEvent && projectFinishedEvent.BuildEventContext != null)
14871487
{
14881488
int key = GetWarningsAsErrorOrMessageKey(projectFinishedEvent);
14891489
_warningsAsErrorsByProject?.Remove(key);
14901490
_warningsNotAsErrorsByProject?.Remove(key);
14911491
_warningsAsMessagesByProject?.Remove(key);
14921492
}
14931493

1494-
if (loggingEvent is BuildEventArgs loggingEventBuildArgs)
1494+
if (loggingEvent is BuildEventArgs)
14951495
{
1496-
RouteBuildEvent(loggingEventBuildArgs);
1496+
RouteBuildEvent(buildEventArgs);
14971497
}
14981498
else if (loggingEvent is KeyValuePair<int, BuildEventArgs> loggingEventKeyValuePair)
14991499
{
1500+
if (loggingEventKeyValuePair.Value != buildEventArgs)
1501+
{
1502+
// buildEventArgs has been altered, lets use that new one
1503+
loggingEventKeyValuePair = new KeyValuePair<int, BuildEventArgs>(loggingEventKeyValuePair.Key, buildEventArgs);
1504+
}
1505+
15001506
RouteBuildEvent(loggingEventKeyValuePair);
15011507
}
15021508
}

0 commit comments

Comments
 (0)