Issue Description
Replaying a binary log with terminal logger fails when the number of nodes specified for replay command is less than the number of nodes originally used during the build.
Steps to Reproduce
- Collect a binary log for a multi-project solution build.
- Attempt to replay it with /m:1
Expected Behavior
Replay succeeds.
Actual Behavior
Getting error "There was an exception while reading the log file: Index was outside the bounds of the array." from the terminal logger.
Stack trace:
at Microsoft.Build.Logging.TerminalLogger.UpdateNodeStatus(BuildEventContext buildEventContext, TerminalNodeStatus nodeStatus) in C:\Users\alinama\work\msbuild\msbuild\src\Build\Logging\TerminalLogger\TerminalLogger.cs:line 990
at Microsoft.Build.Logging.TerminalLogger.TargetStarted(Object sender, TargetStartedEventArgs e) in C:\Users\alinama\work\msbuild\msbuild\src\Build\Logging\TerminalLogger\TerminalLogger.cs:line 977
at Microsoft.Build.Logging.EventArgsDispatcher.Dispatch(BuildEventArgs buildEvent) in C:\Users\alinama\work\msbuild\msbuild\src\Build\Logging\BinaryLogger\EventArgsDispatcher.cs:line 123
at Microsoft.Build.Logging.BinaryLogReplayEventSource.Replay(BuildEventArgsReader reader, CancellationToken cancellationToken) in C:\Users\alinama\work\msbuild\msbuild\src\Build\Logging\BinaryLogger\BinaryLogReplayEventSource.cs:line 264
at Microsoft.Build.Logging.BinaryLogReplayEventSource.Replay(String sourceFilePath, CancellationToken cancellationToken) in C:\Users\alinama\work\msbuild\msbuild\src\Build\Logging\BinaryLogger\BinaryLogReplayEventSource.cs:line 201
at Microsoft.Build.CommandLine.MSBuildApp.ReplayBinaryLog(String binaryLogFilePath, ILogger[] loggers, IEnumerable`1 distributedLoggerRecords, Int32 cpuCount, Boolean isBuildCheckEnabled) in C:\Users\alinama\work\msbuild\msbuild\src\MSBuild\XMake.cs:line 4602
Analysis
This happens because of how terminal logger determines number of nodes to display. During the replay mode it uses currently specified number of nodes, instead of using the number of nodes that was used during the binary log collection.
Workaround: use /m:big_enough_number during replaying.
Versions & Configurations
No response
Issue Description
Replaying a binary log with terminal logger fails when the number of nodes specified for replay command is less than the number of nodes originally used during the build.
Steps to Reproduce
Expected Behavior
Replay succeeds.
Actual Behavior
Getting error "There was an exception while reading the log file: Index was outside the bounds of the array." from the terminal logger.
Stack trace:
Analysis
This happens because of how terminal logger determines number of nodes to display. During the replay mode it uses currently specified number of nodes, instead of using the number of nodes that was used during the binary log collection.
Workaround: use /m:big_enough_number during replaying.
Versions & Configurations
No response