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

Fix incorrect "illegal XML comment chars" check & add regression tests #74787

Merged
merged 2 commits into from
Aug 30, 2022

Conversation

GrabYourPitchforks
Copy link
Member

In PR #69038, we accidentally changed an "ends with" check to a "starts with" check. This fixes that error and improves our regression test coverage. From scanning through the original PR, there were two locations total where it appears we introduced errors into the logic. #71752 (already in the 7.0 RC1 branch) addressed one of them; this PR addresses the remaining location.

Since this is a regression from 6.0 and affects customer scenarios, I'll kick off the backporting process once this PR is merged.

Resolves #74752.

@ghost
Copy link

ghost commented Aug 29, 2022

Tagging subscribers to this area: @dotnet/area-system-xml
See info in area-owners.md if you want to be subscribed.

Issue Details

In PR #69038, we accidentally changed an "ends with" check to a "starts with" check. This fixes that error and improves our regression test coverage. From scanning through the original PR, there were two locations total where it appears we introduced errors into the logic. #71752 (already in the 7.0 RC1 branch) addressed one of them; this PR addresses the remaining location.

Since this is a regression from 6.0 and affects customer scenarios, I'll kick off the backporting process once this PR is merged.

Resolves #74752.

Author: GrabYourPitchforks
Assignees: -
Labels:

area-System.Xml

Milestone: -

@GrabYourPitchforks
Copy link
Member Author

Side observation, not really realted to this PR: the workhorse method behind WriteRaw is really just a glorified "is the input data well-formed UTF-16?" check. That's something we already have internal within the framework, and making it public would allow considerable simplification of these sorts of methods.

@@ -7,5 +7,6 @@
<Compile Include="WriteWithEncoding.cs" />
<Compile Include="WriteWithEncodingWithFallback.cs" />
<Compile Include="WriteWithInvalidSurrogate.cs" />
<Compile Include="XmlTextWriterTests.cs" />
Copy link
Member

Choose a reason for hiding this comment

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

this caught my eye :/ .. as far as I can see our test coverage of XmlTextWriter is minimal. Our tests test various other *Xml*Writers. XmlWriter.Create() doesn't seem to create one either. Not an urgent problem, but I suppose it led to this bug.

@eiriktsarpalis
Copy link
Member

Since this is a regression from 6.0

Was #69038 backported to 6?

@GrabYourPitchforks
Copy link
Member Author

Was #69038 backported to 6?

@eiriktsarpalis No, this only affects 7.0.

@GrabYourPitchforks
Copy link
Member Author

Per suggestion at #74787 (comment), will rerun the tests tomorrow morning against netfx481 just to validate the behavior. Hold off merging until then.

@GrabYourPitchforks GrabYourPitchforks added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Aug 30, 2022
@danmoseley
Copy link
Member

That's something we already have internal within the framework, and making it public would allow considerable simplification of these sorts of methods.

Seems like a reasonable API proposal..

@GrabYourPitchforks
Copy link
Member Author

Tested against 4.8, 3.1, 6.0, and [unpatched] 7.0. Tests succeed on all platforms except the platform where the regression was introduced. So I think we're good for merge!

image

@GrabYourPitchforks
Copy link
Member Author

Test failure is tracked by #74795.

@GrabYourPitchforks GrabYourPitchforks merged commit f825814 into dotnet:main Aug 30, 2022
@GrabYourPitchforks
Copy link
Member Author

/backport to release/7.0

@github-actions
Copy link
Contributor

Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/2957973010

@eiriktsarpalis eiriktsarpalis removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Aug 30, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in the XmlBaseWriter.cs
4 participants