-
-
Notifications
You must be signed in to change notification settings - Fork 998
feat: Add logics to escape MSBuildArgument text representation when contains MSBuild special chars #2730
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
base: master
Are you sure you want to change the base?
Conversation
I'm confused by this PR. The implementation does not match the MSBuild documentation for special characters. Wrapping values with quotes instead just works? Is it documented anywhere? Why does comma need to be escaped also? And why is it only escaping if the value contains |
It just works when using quoted argument. (both with/without
And MSBuild team suggesting to use this workaround(dotnet/sdk#8792 (comment))
It's not listed on MSBuild special characters. (List of argument that support comma can be found by search
It's because other arguments seems to accepts raw |
I've confirmed it's not works when escaped It works when running from command line. I thought this issue also applied to PR It might be better to keep default I'll update this PR later. |
In that case, would it be better to simply wrap the entire argument with quotes? We don't actually use bat files, we just run the command directly (I think those files are used for debug purposes only). |
As far as I've confirmed. It's not works without
Thanks for letting me know. |
I've updated MSBuildArgument escape logics. Escape Logic changes
Other changes1. Change 2. Add integration tests to |
4f7971b
to
395c27a
Compare
395c27a
to
5266994
Compare
This PR intended to fix issue #2719.
There is existing PR(#2729) that trying to resolve issue by escaping MSBuild special chars
Instead, this PR try to resolve issue by surrounding MSBuild parameter value by quotes.
(See: dotnet/sdk#8792 (comment) for details)
What's changed in this PR
1. Argument.cs
Add internal method
GetEscapedTextRepresentation
toMsBuildArgument
.This method returns platform-dependent text representation that is used for script file.
DotNetCliCommand.cs
Modify code to pass
GetEscapedTextRepresentation
value instead ofTextRepresentation
MsBuildArgumentTests.cs
Add unit tests for various argument patterns.
Additional integration tests
I've confirmed benchmarks works as expected both Windows/Ubuntu(on WSL) environments.