Skip to content

Attach MockLogger in WriteLinesToFile test and update test instructions#13235

Merged
rainersigwald merged 1 commit intodotnet:mainfrom
rainersigwald:diagnostics-for-TransactionalModePreservesAllData
Feb 11, 2026
Merged

Attach MockLogger in WriteLinesToFile test and update test instructions#13235
rainersigwald merged 1 commit intodotnet:mainfrom
rainersigwald:diagnostics-for-TransactionalModePreservesAllData

Conversation

@rainersigwald
Copy link
Copy Markdown
Member

@rainersigwald rainersigwald commented Feb 10, 2026

Add MockLogger(_output) to TransactionalModePreservesAllData so build diagnostics
appear in test output. Update tests.instructions.md to require
MockLogger for tests that build via ProjectCollection or BuildManager.

(this test failed, seemingly flakily, in an unrelated PR, so let's get better info out of it)

Add MockLogger(_output) to WriteToReadOnlyFile so build diagnostics
appear in .trx output. Update tests.instructions.md to require
MockLogger for tests that build via ProjectCollection or BuildManager.
@rainersigwald rainersigwald requested a review from a team as a code owner February 10, 2026 18:04
Copilot AI review requested due to automatic review settings February 10, 2026 18:04
@rainersigwald rainersigwald self-assigned this Feb 10, 2026
Copy link
Copy Markdown
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 improves test diagnostics by adding MockLogger to a test that builds via ProjectCollection and updating the test instructions to require this pattern for all similar tests. The change helps capture build errors and warnings in test output when tests fail in CI, making it easier to diagnose flaky failures.

Changes:

  • Added MockLogger(_output) to the TransactionalModePreservesAllData test to capture build diagnostics
  • Updated test instructions to mandate attaching MockLogger for all tests that invoke builds via ProjectCollection or BuildManager

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Tasks.UnitTests/WriteLinesToFile_Tests.cs Added MockLogger instantiation and passed it to ProjectCollection's loggers parameter using collection expression syntax
.github/instructions/tests.instructions.md Added requirement that tests using ProjectCollection or BuildManager must attach MockLogger(_output) for CI diagnostics

@rainersigwald rainersigwald enabled auto-merge (squash) February 10, 2026 18:28
@rainersigwald rainersigwald merged commit 0027a11 into dotnet:main Feb 11, 2026
16 checks passed
@rainersigwald rainersigwald deleted the diagnostics-for-TransactionalModePreservesAllData branch February 11, 2026 10:07
Copilot AI pushed a commit that referenced this pull request Feb 17, 2026
…ns (#13235)

Add `MockLogger(_output)` to `TransactionalModePreservesAllData` so
build diagnostics appear in test output. Update `tests.instructions.md`
to require MockLogger for tests that build via ProjectCollection
or BuildManager.
JanProvaznik pushed a commit to JanProvaznik/msbuild that referenced this pull request Feb 25, 2026
…ns (dotnet#13235)

Add `MockLogger(_output)` to `TransactionalModePreservesAllData` so
build diagnostics appear in test output. Update `tests.instructions.md`
to require MockLogger for tests that build via ProjectCollection
or BuildManager.
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.

5 participants