Skip to content

Restore newline auto return#8013

Merged
Forgind merged 3 commits intodotnet:mainfrom
Forgind:remove-extra-space
Oct 10, 2022
Merged

Restore newline auto return#8013
Forgind merged 3 commits intodotnet:mainfrom
Forgind:remove-extra-space

Conversation

@Forgind
Copy link
Contributor

@Forgind Forgind commented Sep 29, 2022

Fixes #8008

Context

With the MSBuild server, I added support for VT100, which meant we could understand colorization and such from an older command prompt, but I also added DISABLE_NEWLINE_AUTO_RETURN, which made the UI look worse.

Customer Impact

Customers using MSBuild server and trying to print newlines (\n) will see output with extra space.

Testing

Manually tested the change: ran the proposed repro project and saw the bug. Overwrote the MSBuild in that SDK with custom bits from this PR and retested it, and I could no longer reproduce the issue. Tried using MSBuild.exe on a random project, and the important part of the VT100 change was preserved.

Code Reviewers

rokonec

Description of fix

Removed the DISABLE_NEWLINE_AUTO_RETURN argument

@rainersigwald
Copy link
Member

The bug mentioned an alternate solution strategy, which was "replace the mode at the end of the build". Did you consider and discard that? Is this a better option?

@Forgind
Copy link
Contributor Author

Forgind commented Sep 29, 2022

I was the one who first noticed the VT100 issue because I use cmd for most things. I typically believe the simplest solution that resolves the problem is the best solution, as it is least likely to have hidden bugs, and this simplifies the code rather than potentially leaving some issue open with a build that fails to reset the mode after some unusual sequence of events. I tested that this did not reintroduce the issue I'd seen by building something with the bootstrapped MSBuild.exe. If the problem remains resolved, and the code is simpler, I think it is the best solution.

@Forgind Forgind requested review from AR-May and rokonec September 29, 2022 20:19
Copy link
Member

@rokonec rokonec left a comment

Choose a reason for hiding this comment

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

Looks legit. What was the intent behind disabling it originally?

@Forgind
Copy link
Contributor Author

Forgind commented Sep 29, 2022

Looks legit. What was the intent behind disabling it originally?

As I recall, I found code that claimed to resolve the VT100 issue. I put it into MSBuild and tried testing it, and it seemed to work properly whether or not that parameter was present. Since whoever wrote the snippet I'd found online seemed to think it was important, I figured there was some case I hadn't tested where it would be useful, so I left it in.

@rainersigwald
Copy link
Member

Does leaving ENABLE_VIRTUAL_TERMINAL_PROCESSING on have no cost to subsequent CLI interactions or user programs in dotnet run? Wouldn't it mask the need to set that in the actual application if it emits VT100 codes?

@rainersigwald
Copy link
Member

For instance, is this behavior difference acceptable, even if we fix the newline situation?

image

@Forgind
Copy link
Contributor Author

Forgind commented Sep 29, 2022

For clarity, is your concern that it converted \x1b[31m into "change the color to red"? Honestly, I don't know why someone would want to see \x1b[31m.

But cc @baronfel for a proper opinion.

@rainersigwald
Copy link
Member

Yes, that's the concern. It's possible that it's explicitly outputting that for Reasons, but I would say my concern runs the other way: if you run it with dotnet run and it always renders the VT100 codes instead of spewing console gibberish, you'll likely be surprised when the deployed app instead spews gibberish.

@baronfel
Copy link
Member

Correct - @rainersigwald has the scenario nailed here. MSBuild should return the state to whatever it was before invoking MSBuild. Other applications shouldn't have to alter their behavior based on whether or not they were run after MSBuild in a dotnet run scenario.

@Forgind
Copy link
Contributor Author

Forgind commented Sep 29, 2022

Ok, that's more reasonable than wanting random codes in your output. I'd suggest that's perpendicular to this change, as this change is specifically for newline and (in my opinion) should happen regardless. I can try to put something together to resolve that issue as well.

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Oct 3, 2022
@Forgind Forgind merged commit 2605f91 into dotnet:main Oct 10, 2022
@Forgind Forgind deleted the remove-extra-space branch October 10, 2022 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breaking change in linebreak handling in 7.0 RC1

4 participants