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

Permit specifying that we should use utf-8 in ToolTask #6188

Merged
merged 2 commits into from
Mar 3, 2021

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Feb 23, 2021

Fixes #5724

Changes Made

Added UseUtf8Encoding parameter to ToolTask and removed it from Exec. Exec is a ToolTaskExtension, which is clearly an extension of ToolTask, but this may still count as a breaking change, in which case I could add it back to Exec with new to make it compile.

Testing

MrTrillian tried this with a reduced repro solution, and it resolved the problem.

Copy link
Member

@benvillalobos benvillalobos left a comment

Choose a reason for hiding this comment

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

LGTM. This looks like the right approach for #6168 as well. We have it as up for grabs, so I'll leave that up to you if you want to add the ability to specify BOM usage "while we're here"™

@Forgind
Copy link
Member Author

Forgind commented Feb 25, 2021

WriteLinesToFile isn't a ToolTask, so although the fix would probably look almost identical, the code itself would be almost disjoint unless we wanted to move the ability to set encoding all the way back to TaskExtension, which doesn't really make sense. I'll leave it as-is, just noting that anyone working on that will hopefully see it referenced here and draw inspiration from this PR.

@@ -333,7 +333,6 @@ public partial class Exec : Microsoft.Build.Tasks.ToolTaskExtension
[Microsoft.Build.Framework.OutputAttribute]
public string StdOutEncoding { get { throw null; } set { } }
protected override string ToolName { get { throw null; } }
public string UseUtf8Encoding { get { throw null; } set { } }
Copy link
Contributor

Choose a reason for hiding this comment

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

Weird that the API addition in ToolTask does not show up.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's in M.B.Utilities.Core, so it's the next file. I was wondering if I should count this as a breaking change because someone could use UseUtf8Encoding for Exec without loading Utilities.Core, but I don't think there's anything that calls into it, so I think it's ok.

@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 Mar 1, 2021
@benvillalobos benvillalobos merged commit 30a79b0 into dotnet:master Mar 3, 2021
@Forgind Forgind deleted the UseUtf8Encoding branch April 20, 2021 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Localization merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. Partner request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Globalization: ToolTask batch file encoding does not respect UTF-8 encoding
3 participants