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 NRT annotations for XmlProcessingInstruction #73687

Merged
merged 3 commits into from
Aug 12, 2022

Conversation

krwq
Copy link
Member

@krwq krwq commented Aug 10, 2022

Fixes #71862

When we originally annotated XML we avoided any product changes which resulted in some annotations being incorrect.

@SteveDunn has found one of such inconsistencies when annotation S.S.Cryptography.Xml (#67198) and reported. This is fixing this inconsistency and matches behavior with spec and implementation.

Per https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-pi:

  • target cannot be null - current implementation will throw when it encounters null target: I'm changing the behavior to throw and making it explicitly non-nullable
  • data - per spec this is optional although for current implementation there is no distinction between empty and null and current implementation return empty string when data is not provided: I'm changing the behavior that all getters for Data/Value (and whatever else it's called) are non-nullable and all setters are nullable - null will always translate to empty string since per spec it's equivalent and will make it most consistent with current implementation

cc: @SteveDunn

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost assigned krwq Aug 10, 2022
@ghost
Copy link

ghost commented Aug 10, 2022

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

Issue Details

Fixes #71862

When we originally annotated XML we avoided any product changes which resulted in some annotations being incorrect.

@SteveDunn has found one of such inconsistencies when annotation S.S.Cryptography.Xml (#67198) and reported. This is fixing this inconsistency and matches behavior with spec and implementation.

Per https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-pi:

  • target cannot be null - current implementation will throw when it encounters null target: I'm changing the behavior to throw and making it explicitly non-nullable
  • data - per spec this is optional although for current implementation there is no distinction between empty and null and current implementation return empty string when data is not provided: I'm changing the behavior that all getters for Data/Value (and whatever else it's called) are non-nullable and all setters are nullable - null will always translate to empty string since per spec it's equivalent and will make it most consistent with current implementation

cc: @SteveDunn

Author: krwq
Assignees: -
Labels:

area-System.Xml

Milestone: -

@krwq krwq requested a review from layomia August 10, 2022 13:22
Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM to me. Just one small nit.

@krwq krwq force-pushed the xml-processing-instruction branch from e4b0ae7 to e60e59b Compare August 11, 2022 20:40
@krwq krwq merged commit 280c373 into dotnet:main Aug 12, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 12, 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.

Fix NRT annotations on XmlProcessingInstruction
4 participants