Attach MockLogger in WriteLinesToFile test and update test instructions#13235
Merged
rainersigwald merged 1 commit intodotnet:mainfrom Feb 11, 2026
Conversation
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.
Contributor
There was a problem hiding this comment.
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 theTransactionalModePreservesAllDatatest 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 |
baronfel
approved these changes
Feb 10, 2026
JanProvaznik
approved these changes
Feb 11, 2026
ViktorHofer
approved these changes
Feb 11, 2026
This was referenced Feb 12, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
MockLogger(_output)toTransactionalModePreservesAllDataso build diagnosticsappear in test output. Update
tests.instructions.mdto requireMockLogger 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)