Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Migrate to System.Text.Encoding.Web #449

Merged
merged 1 commit into from
Oct 30, 2015
Merged

Migrate to System.Text.Encoding.Web #449

merged 1 commit into from
Oct 30, 2015

Conversation

Tratcher
Copy link
Member

#391 @davidfowl @muratg @Eilon

David asked me to keep the interfaces for DI, so I replaced the encoders with wrappers. Components that were not using the interfaces I change to directly use the BCL types.

return _encoder.Encode(value);
}

public void HtmlEncode(string value, int startIndex, int charCount, TextWriter output)
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we change these method names and parameter ordering to match the new BCL APIs? It will make it easier for people to switch between our DI wrapper and the underlying BCL types, but it's more of a break for us.

Copy link

Choose a reason for hiding this comment

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

Having parity between the wrapper and BCL types makes sense to me. How much work would it be to do it?

@Tratcher
Copy link
Member Author

@muratg Updated with the new names and signatures. It will make the down stream breaks much worse, but is probably better in the long run.

@Tratcher
Copy link
Member Author

+@rynowak who does not like wrappers.

@Eilon Eilon mentioned this pull request Oct 21, 2015
4 tasks
@Tratcher
Copy link
Member Author

@davidfowl Removing the wrappers mostly works, except that it's much harder to mock and test because the needed methods aren't virtual.
90c13ad
Compare the old CommonTestEncoder (90c13ad#diff-5093aee64e24c262ac1165902a6ceef9) with the new HtmlTestEncoder (90c13ad#diff-387f3dc26a94ebcb7c37dd754bab84c5)

@Tratcher
Copy link
Member Author

dotnet/corefx#4038

"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.11-beta-*",
"System.ComponentModel": "4.0.1-beta-*",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, is this actually used? I'm curious for what...

Copy link
Member Author

Choose a reason for hiding this comment

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

System.Text.Encodings.Web seems to require it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Won't the transitive dependency solve that?

Copy link
Member

Choose a reason for hiding this comment

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

Should...

@Eilon
Copy link
Contributor

Eilon commented Oct 21, 2015

:shipit:

@@ -154,13 +163,23 @@ public static QueryString Create(IEnumerable<KeyValuePair<string, StringValues>>
bool first = true;
foreach (var pair in parameters)
{
if (pair.Key == null)
{
throw new ArgumentNullException(nameof(pair.Key));
Copy link

Choose a reason for hiding this comment

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

InvalidOperationException as this is not an arg.

@Eilon
Copy link
Contributor

Eilon commented Oct 21, 2015

Clarification: My :shipit: was contingent on an offline discussion regarding keeping the interfaces. I don't think it's bad either way, but I prefer the nice interfaces.

"dependencies": {
"System.Text.Encodings.Web": "4.0.0-beta-*"
},
"frameworks": {
Copy link
Member

Choose a reason for hiding this comment

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

These need to be updated to use generations now

@Tratcher Tratcher added this to the 1.0.0-rc2 milestone Oct 27, 2015
@Tratcher Tratcher self-assigned this Oct 27, 2015
@Tratcher
Copy link
Member Author

Rebased and updated. Now that we have the right virtuals we can remove the interfaces and the entire WebEncoders.Core package.

CommonTestEncoder is also replaced by HtmlTestEncoder, UrlTestEncoder, and JavaScriptTestEncoder, provided directly in the WebEncoders package.

@Eilon
Copy link
Contributor

Eilon commented Oct 27, 2015

I miss the interfaces, but :shipit:

@Tratcher Tratcher merged commit be4fb46 into dev Oct 30, 2015
@Tratcher Tratcher deleted the tratcher/encoding branch October 30, 2015 17:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants