Adds validation to throw MSB4259 when property references contain leading or trailing whitespace outside of conditions.#13076
Merged
JanProvaznik merged 11 commits intodotnet:mainfrom Jan 30, 2026
Conversation
…ding or trailing whitespace outside of conditions.
…y' of https://github.com/huulinhnguyen-dev/msbuild into dev/huulinhnguyen/issue_error_for_whitespace_in_property
Member
JanProvaznik
left a comment
There was a problem hiding this comment.
a couple of questions to clarify if this is mergeable
bee934d to
29a86ed
Compare
YuliiaKovalova
approved these changes
Jan 30, 2026
JanProvaznik
approved these changes
Jan 30, 2026
Member
|
So I can't open any Razor projects in VS main, because of a space in a targets file in my Program Files (x86) folder, that was last modified in 2019. This is a little disruptive :) |
JanProvaznik
added a commit
to JanProvaznik/msbuild
that referenced
this pull request
Feb 3, 2026
…tain leading or trailing whitespace outside of conditions. (dotnet#13076)" This reverts commit fa41623.
JanProvaznik
added a commit
that referenced
this pull request
Feb 3, 2026
…ces contain leading or trailing whitespace outside of conditions. (#13184)
Copilot AI
pushed a commit
that referenced
this pull request
Feb 3, 2026
…ces contain leading or trailing whitespace outside of conditions. (#13184)
colincmac
added a commit
to colincmac/grpc
that referenced
this pull request
Feb 3, 2026
…perty function (VS 18.5 Insiders / MSBuild) Fixes grpc#41548 Grpc.Tools 2.76.0 currently contains a property function invocation in: build/_protobuf/Google.Protobuf.Tools.props that triggers the following error: Unexpected space at position "3" of property reference "$( [System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../../tools) )". Did you forget to remove a space? This PR removes the invalid whitespace from that property reference so that projects consuming Grpc.Tools load and build correctly under the newer MSBuild validation. Reference: dotnet/msbuild PR introducing the validation/error: dotnet/msbuild#13076
JanProvaznik
added a commit
to JanProvaznik/msbuild
that referenced
this pull request
Feb 25, 2026
…eferences contain leading or trailing whitespace outside of conditions. (dotnet#13184)
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 #12352 Adds validation to throw MSB4259 when property references contain leading or trailing whitespace outside of conditions.
Context
Property references with whitespace like
$( Foo )silently expand to empty string instead of throwing error MSB4259. The validation in Scanner.cs only works for Conditions, not for general property expansion.Changes Made
Expander.csfor regular property path (line ~1385)PropertySimpleSpacedto expect MSB4259 error instead of empty stringTesting
PropertyWithWhitespace_ShouldThrowError: verifies$( Foo ),$( Foo),$(Foo )throw MSB4259PropertyFunctionWithWhitespaceInParameters_ShouldSucceed: verifies$(Foo.StartsWith( 'bar' ))still worksNotes