Skip to content

TerminalLogger node status is lost after MSBuild task yields and resumes #12819

Description

@JanProvaznik

Issue Description

When a project uses the <MSBuild> task to build another project (e.g., using BuildInParallel="true" or just calling another project), the current node "yields" execution to the other project. TerminalLogger correctly handles the start of this yield by clearing the node status in TaskStarted("MSBuild") to indicate the node is waiting.

However, TerminalLogger fails to restore the node status when the <MSBuild> task finishes and the node resumes execution. This results in the node's status remaining null for the rest of the project's execution.

This causes:

  1. "Invisible" nodes in the terminal output (nodes doing work but not showing up in the status bar).
  2. Potential NullReferenceExceptions or missing data in other loggers/handlers that rely on the current node status (as seen in the related VSTest reporting issue).

Steps to Reproduce

  1. Download and extract the attached Project.zip

  2. Run the build using the following command:

    msbuild Repro\Main.proj /t:Build /m /tl:on

Expected Behavior

When Leaf.proj finishes and Worker.proj resumes (during the sleep), the terminal status bar should show the Worker node as active (e.g., Worker (Build) (x.xs)).

Actual Behavior

The terminal status bar does not show the Worker node during the sleep phase. The node slot appears empty or is not updated, because the internal state is null.

Analysis

The issue is in TerminalLogger.cs. There is a handler for TaskStarted that clears the node status when e.TaskName == "MSBuild", but there is no corresponding logic in TaskFinished to restore the status from the TerminalProjectInfo.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Terminal LoggerProblems with the livelogger/fancylogger/terminallogger -tl functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions