Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

Context

In quiet mode (-v:q), warnings and errors were rendered immediately without project context. Users saw diagnostic messages but couldn't identify which project they came from.

CSC : warning MSTEST0001: Explicitly enable or disable tests parallelization

Changes Made

Modified diagnostic accumulation logic

  • WarningRaised and ErrorRaised now accumulate diagnostics in the project's BuildMessages collection regardless of verbosity
  • Removed verbosity check that caused immediate rendering in quiet mode
  • Preserved immediate rendering for auth provider warnings and immediate warnings (MSB3026)

Modified project summary rendering

  • ProjectFinished now displays project summaries in quiet mode when HasErrorsOrWarnings is true
  • Projects without diagnostics remain hidden in quiet mode as expected
  • Simplified quiet mode detection logic: Verbosity < LoggerVerbosity.Quiet || (Verbosity == LoggerVerbosity.Quiet && !project.HasErrorsOrWarnings)
  • Skip DisplayNodes() call in quiet mode to avoid writing unnecessary cursor hide/show ANSI codes since there's no dynamic refresh

Result in quiet mode:

  project failed with 1 error(s) and 2 warning(s) (0.2s)
    directory/file(1,2,3,4): warning AA0000: Warning message
    directory/file(1,2,3,4): error AA0000: Error message

Testing

  • Updated snapshot files for PrintBuildSummaryQuietVerbosity_FailedWithErrors across Linux/OSX/Windows
  • All 69 TerminalLogger tests pass
  • Verified successful projects still produce no output in quiet mode
  • Verified no cursor control codes are written in quiet mode output

Notes

Uses the same project-grouping primitives as higher verbosity levels, toggled by runtime state per maintainer guidance.

Original prompt

This section details on the original issue you should resolve

<issue_title>Terminal logger quiet mode hides projects</issue_title>
<issue_description>This was reported by @gao-artur in microsoft/testfx#7051

Here is a new project created from the MSTest template without MSTestSettings.cs file + the binlog. Built with

dotnet build -bl -v q
TestProject11.zip

In that thread we determined that -tl status affects the usefulness of the output for messages that do not have a specific file associated with them:

dotnet build
Restore complete (4.0s)
  TestProject11 net9.0 succeeded with 1 warning(s) (2.3s) → bin\Debug\net9.0\TestProject11.dll
    CSC : warning MSTEST0001: Explicitly enable or disable tests parallelization (https://learn.microsoft.com/dotnet/core/testing/mstest-analyzers/mstest0001)

Build succeeded with 1 warning(s) in 7.2srm -r .\obj\dotnet build -v:q
CSC : warning MSTEST0001: Explicitly enable or disable tests parallelization (https://learn.microsoft.com/dotnet/core/testing/mstest-analyzers/mstest0001)

The associated project TestProject11 is not mentioned anywhere in the latter. I think that's unreasonable even when the user has requested "quiet".</issue_description>

<agent_instructions>Try to update the diagnostic/warning/error message rendering in quiet mode so that it doesn't use the 'immediate' mode formatting, the final output should only show the diagnostics for projects that failed or had warnings.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@baronfel A few approaches to consider:
  • in quiet mode appending/prepending the project if it exists to the 'message formatting' part of the line
  • in quiet mode using the same project-based grouping as we do in non-quiet mode, instead of assuming that quiet mode should trigger some kind of flat-list-only output</comment_new>
    <comment_new>@rainersigwald
    Yeah I waffled between the two myself, I think I lean to the latter right now though.</comment_new>
    <comment_new>@baronfel
    I do too - it feels more like a 'modular' approach - use the same 'primitives' that can be toggled on/off based on run-time state, etc.</comment_new>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 12, 2025 17:54
…rrors

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix terminal logger quiet mode to show projects Fix terminal logger quiet mode to show project context for warnings/errors Dec 12, 2025
Copilot AI requested a review from baronfel December 12, 2025 18:02
@baronfel
Copy link
Member

@copilot since in quiet mode there is no dynamic refresh, can we prevent the hide/show pair from being written at all?

…ow codes

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 12, 2025

@copilot since in quiet mode there is no dynamic refresh, can we prevent the hide/show pair from being written at all?

Fixed in fde9744. Added && Verbosity > LoggerVerbosity.Quiet check before calling DisplayNodes() in ProjectFinished(), since there's no dynamic refresh happening in quiet mode. The hide/show cursor codes are no longer written to the output.

@baronfel baronfel marked this pull request as ready for review December 12, 2025 20:31
Copilot AI review requested due to automatic review settings December 12, 2025 20:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes terminal logger quiet mode (-v:q) to display project context for warnings and errors. Previously, diagnostics in quiet mode were rendered immediately without project information, making it impossible to identify which project they originated from.

Key Changes:

  • Modified diagnostic accumulation to store warnings/errors in project collections regardless of verbosity level
  • Changed project summary rendering to display projects with errors/warnings even in quiet mode
  • Added logic to skip cursor control codes in quiet mode since there's no dynamic refresh

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Build/Logging/TerminalLogger/TerminalLogger.cs Core logic changes: removed verbosity checks from warning/error accumulation; added quiet mode handling to show projects with diagnostics; skips DisplayNodes() in quiet mode to avoid unnecessary ANSI codes
src/Build.UnitTests/Snapshots/TerminalLogger_Tests.PrintBuildSummaryQuietVerbosity_FailedWithErrors.Windows.verified.txt Updated test snapshot showing new output format with project header and indented diagnostics
src/Build.UnitTests/Snapshots/TerminalLogger_Tests.PrintBuildSummaryQuietVerbosity_FailedWithErrors.OSX.verified.txt Updated test snapshot for macOS platform
src/Build.UnitTests/Snapshots/TerminalLogger_Tests.PrintBuildSummaryQuietVerbosity_FailedWithErrors.Linux.verified.txt Updated test snapshot for Linux platform

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal logger quiet mode hides projects

2 participants