Skip to content

Add nullability annotations to System.Private.Xml.Linq project - #40744

Merged
jozkee merged 4 commits into
dotnet:masterfrom
jozkee:nullability_xpath4
Aug 20, 2020
Merged

Add nullability annotations to System.Private.Xml.Linq project#40744
jozkee merged 4 commits into
dotnet:masterfrom
jozkee:nullability_xpath4

Conversation

@jozkee

Copy link
Copy Markdown
Member

Contributes to #2339

@jozkeejozkee added this to the 5.0.0 milestone Aug 13, 2020
@jozkee
jozkee requested review from a team, buyaa-n and krwqAugust 13, 2020 00:07
@jozkeejozkee self-assigned this Aug 13, 2020
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @buyaa-n, @krwq
See info in area-owners.md if you want to be subscribed.

Comment threadsrc/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/Extensions.cs Outdated
Comment threadsrc/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XAttribute.cs Outdated
Comment threadsrc/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XAttribute.cs Outdated
}

public virtual object Evaluate(string xpath, IXmlNamespaceResolver resolver)
public virtual object Evaluate(string xpath, IXmlNamespaceResolver? resolver)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should all resolvers above also be nullable?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yes, and also in other places where a IXmlNamespaceResolver is taken, not sure if everywhere but we should be able to take null in other cases, e.g:

publicvirtualobjectReadContentAs(TypereturnType,IXmlNamespaceResolvernamespaceResolver)

The docs also mention that the param can be null https://docs.microsoft.com/dotnet/api/system.xml.xmlreader.readcontentas?view=netcore-3.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do the other places IXmlNamespaceResolver is taken still need to be updated to be nulalble?

@jozkeejozkeeAug 20, 2020

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

XmlReader.ReadContentAs(Type, IXmlNamespaceResolver) is yet as not-nullable so I assume is the same for the other cases if they exists.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I did a scan through the methods that can take IXmlNamespaceResolver and found a few ones that could be changed to IXmlNamespaceResolver?. I submitted #41079 with the changes.

Comment threadsrc/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs Outdated
@jozkee
jozkeeforce-pushed the nullability_xpath4 branch from 66f7021 to 43ba8e1CompareAugust 18, 2020 22:49
@jozkeejozkee changed the title Add nullability annotations to Xml.Linq projectAdd nullability annotations to System.Private.Xml.Linq projectAug 20, 2020

@krwqkrwq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for fixing, please ensure build errors are fixed or known issues

@jozkee

Copy link
Copy Markdown
MemberAuthor

CI issues are unrelated, see #41006.

@jozkee
jozkee merged commit 9d26606 into dotnet:masterAug 20, 2020
@jozkee
jozkee deleted the nullability_xpath4 branch August 20, 2020 08:56
@ghostghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for freeto 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.

3 participants

@jozkee@krwq@jeffhandley