Fix the crash when doing preprocess#12396
Merged
YuliiaKovalova merged 3 commits intodotnet:mainfrom Oct 9, 2025
Merged
Conversation
f07c5d1 to
5a98631
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
Fixes a crash when using MSBuild's preprocess functionality by preventing logger registration during preprocessing operations. The change ensures that loggers are only registered when actually building projects, not when preprocessing them.
- Modifies ProjectCollection constructor to conditionally register loggers based on preprocess mode
- Adds comprehensive test coverage for preprocessing with various verbosity and parallelization options
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/MSBuild/XMake.cs | Conditionally passes null instead of loggers to ProjectCollection when preprocessing |
| src/MSBuild.UnitTests/XMake_Tests.cs | Adds new test method with multiple parameter combinations to verify preprocessing works correctly |
YuliiaKovalova
approved these changes
Oct 9, 2025
This was referenced Feb 23, 2026
Merged
Open
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.
Fixes #12248
Context
see #12248 (comment)
Changes Made
Don't register loggers during creating ProjectCollection when doing preprocess because the project isn't built and loggers are not needed.
Testing
Add new tests.
Notes