Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: Exec task trims leading whitespace in ConsoleToMsBuild #9722

Merged
merged 6 commits into from
Feb 9, 2024

Conversation

surayya-MS
Copy link
Member

Fixes #9668

Context

See the issue description with example

Changes Made

Here the string is trimmed of all whitespace characters:

msbuild/src/Tasks/Exec.cs

Lines 411 to 413 in 195e7f5

if (ConsoleToMSBuild)
{
string trimmedTextLine = singleLine.Trim();

I changed it to trim only the end, so that the leading whitespace characters are preserved in the output

Testing

Added a unit test and tried out the example in the issue manually

Notes

@surayya-MS surayya-MS marked this pull request as ready for review February 8, 2024 14:09
@surayya-MS surayya-MS requested review from AR-May and removed request for rokonec February 8, 2024 14:27
@surayya-MS surayya-MS self-assigned this Feb 8, 2024
Copy link
Member

@AR-May AR-May left a comment

Choose a reason for hiding this comment

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

LGTM, I only have one suggestion concerning the testing.

src/Tasks.UnitTests/Exec_Tests.cs Outdated Show resolved Hide resolved
Copy link
Member

@AR-May AR-May left a comment

Choose a reason for hiding this comment

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

Forgot to change from "Comment" to "Approve".

Copy link
Contributor

@f-alizada f-alizada left a comment

Choose a reason for hiding this comment

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

LGTM, left one question out of curiosity

src/Tasks/Exec.cs Outdated Show resolved Hide resolved
@surayya-MS surayya-MS merged commit c6bee85 into dotnet:main Feb 9, 2024
8 checks passed
@surayya-MS surayya-MS deleted the exec-task-consoletomsbuild-trim branch February 9, 2024 14:51
@ladipro
Copy link
Member

ladipro commented Feb 9, 2024

The change wave check should be documented in https://github.com/dotnet/msbuild/blob/main/documentation/wiki/ChangeWaves.md#1710.

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.

Exec task trims leading whitespace in ConsoleToMsBuild
5 participants