-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add nullability annotations to System.Private.Xml.Linq project #40744
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
Conversation
src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/Extensions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XAttribute.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XAttribute.cs
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| public virtual object Evaluate(string xpath, IXmlNamespaceResolver resolver) | ||
| public virtual object Evaluate(string xpath, IXmlNamespaceResolver? resolver) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
| public virtual object ReadContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver) |
The docs also mention that the param can be null https://docs.microsoft.com/dotnet/api/system.xml.xmlreader.readcontentas?view=netcore-3.1
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XDocumentType.cs
Show resolved
Hide resolved
src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XNodeReader.cs
Show resolved
Hide resolved
66f7021 to
43ba8e1
Compare
krwq
left a comment
There was a problem hiding this comment.
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
|
CI issues are unrelated, see #41006. |
Contributes to #2339