-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
breaking a string on many lines produce incorrect result if followed by a call #96948
Conversation
Tagging subscribers to this area: @dotnet/area-system-codedom Issue DetailsFixes #91060
|
src/libraries/System.CodeDom/src/Microsoft/CSharp/CSharpCodeGenerator.cs
Outdated
Show resolved
Hide resolved
b.Insert(0, '('); | ||
b.Append(')'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pedrobsaila I am not expert here and do not understand how wrapping in a bracket would help, could you explain or is there a doc/reference I could check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bracket forces the next function expression to be evaluated on the whole string instead of just the last substring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the easy road by doing this, I could :
- improve it by doing a sort of lookup so i add the bracket to a splitted string only if it is used as argument to the next function expression but the code does not pass context information to the process of code generation
- or just stop splitting strings
If you see better solutions, let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thank you for explanation, I was expecting we just stop splitting strings, but I guess that is better for styling. I have no better suggestion, the fix LGTM.
I see @steveharter mentioned in the issue string concat using + when it shouldn't be doing that
, not sure what else we could use other than +
, but what he might have a better solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the bracket approach is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Fixes #91060