From ed8d50f9137f3b079a2548a8ba6e8766934434f4 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Thu, 2 Mar 2023 02:27:15 +0100 Subject: [PATCH] Fix logging of node reuse (#8509) Fixes issue causing failing insertion https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/454231 Context Setting verbose logging and rebuilding twice was leading to build errors. This was caused by the fact that low-pri node reuse log event didn't have BuildContext set and ParallelConsoleLogger was choking on it (null ref). Fix Setting BuildEventContext on the node reuse log event --- .../Components/Communications/NodeProviderOutOfProcBase.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs index c9223838572..7346954557d 100644 --- a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs +++ b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs @@ -287,7 +287,10 @@ bool TryReuseAnyFromPossibleRunningNodes(int nodeId) // Connection successful, use this node. CommunicationsUtilities.Trace("Successfully connected to existed node {0} which is PID {1}", nodeId, nodeToReuse.Id); string msg = ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("NodeReused", nodeId, nodeToReuse.Id); - _componentHost.LoggingService.LogBuildEvent(new BuildMessageEventArgs(msg, null, null, MessageImportance.Low)); + _componentHost.LoggingService.LogBuildEvent(new BuildMessageEventArgs(msg, null, null, MessageImportance.Low) + { + BuildEventContext = new BuildEventContext(nodeId, BuildEventContext.InvalidTargetId, BuildEventContext.InvalidProjectContextId, BuildEventContext.InvalidTaskId) + }); CreateNodeContext(nodeId, nodeToReuse, nodeStream); return true;