Skip to content

Conversation

@jozkee
Copy link
Member

@jozkee jozkee commented Aug 28, 2020

Switches Markup property from XmlNode[]? to XmlNode?[]? in XmlSchemaAppInfo and XmlSchemaDocumentation.

@jozkee jozkee added this to the 5.0.0 milestone Aug 28, 2020
@jozkee jozkee self-assigned this Aug 28, 2020
@ghost
Copy link

ghost commented Aug 28, 2020

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

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

LGTM but please get another review. 😃

for (int ia = 0; ia < a.Length; ia++)
{
XmlNode ai = (XmlNode)a[ia];
XmlNode ai = (XmlNode)a[ia]!;
Copy link
Member

Choose a reason for hiding this comment

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

How do we know this can't be null?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not 100% sure but if ai happens to be null that would cause a NRE in line 552. So product code already assumes that ai can't be null.

}

internal override void ProcessMarkup(XmlNode[] markup)
internal override void ProcessMarkup(XmlNode?[] markup)
Copy link
Member

Choose a reason for hiding this comment

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

Why can't markup be null here?

Copy link
Member Author

Choose a reason for hiding this comment

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

markup is always initialized in the only call site.

XmlNode?[] markup = new XmlNode[list.Count];
for (int i = 0; i < list.Count; i++)
{
markup[i] = list[i];
}
_builder!.ProcessMarkup(markup);

}

internal override void ProcessMarkup(XmlNode[] markup)
internal override void ProcessMarkup(XmlNode?[] markup)
Copy link
Member

Choose a reason for hiding this comment

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

Why can't markup be null?

Copy link
Member Author

@jozkee jozkee Aug 28, 2020

Choose a reason for hiding this comment

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

Same answer as previous comment #41488 (comment).

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.

:shipit:

@jozkee jozkee merged commit 7408f1b into dotnet:master Aug 28, 2020
@jozkee jozkee deleted the nullability_markup branch August 28, 2020 06:58
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
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.

5 participants