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

[Group 5] Enable nullable annotations for Microsoft.Extensions.Configuration.Xml #67178

Merged
merged 2 commits into from
Apr 1, 2022

Conversation

maxkoshevoi
Copy link
Contributor

@maxkoshevoi maxkoshevoi commented Mar 25, 2022

Related to #43605

System.Security.Cryptography.Xml is not annotated yet (maybe will get around to it in some time), but it's only used in one place where there's no nullability questions (#66892 (comment)).

Questions:

@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 added the community-contribution Indicates that the PR has been added by a community member label Mar 25, 2022
@ghost
Copy link

ghost commented Mar 25, 2022

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

Issue Details

Related to #43605

System.Security.Cryptography.Xml is not annotated yet (maybe will get around to it in some time), but it's only used in one place where there's no nullability questions.

Questions:

Author: maxkoshevoi
Assignees: -
Labels:

new-api-needs-documentation, area-Extensions-Configuration, community-contribution

Milestone: -

@eerhardt
Copy link
Member

eerhardt commented Apr 1, 2022

CreateNavigator() can return null here

Looking at the code, I believe this can only return null when the XmlNode you call it on is one of these:

case XmlNodeType.EntityReference:
case XmlNodeType.Entity:
case XmlNodeType.DocumentType:
case XmlNodeType.Notation:
case XmlNodeType.XmlDeclaration:
return null;

Since we are calling it on XmlDocument, I don't believe this will ever return null, so the suppression is safe.

@krwq - is this something we can fix in the annotations for System.Xml? I think we can remove the ? here:

public override XPathNavigator? CreateNavigator()
{
return CreateNavigator(this);
}

XmlDocument.CreateNavigator() should never return null.

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. Thanks again @maxkoshevoi.

@eerhardt eerhardt merged commit 063d080 into dotnet:main Apr 1, 2022
@maxkoshevoi maxkoshevoi deleted the mk/43605-configuration-xml branch April 1, 2022 20:48
@ghost ghost locked as resolved and limited conversation to collaborators May 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Configuration community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants