Skip to content

Switch Markup property to XmlNode?[]? to reflect it can contain null elements - #41488

Merged
jozkee merged 2 commits into
dotnet:masterfrom
jozkee:nullability_markup
Aug 28, 2020
Merged

Switch Markup property to XmlNode?[]? to reflect it can contain null elements#41488
jozkee merged 2 commits into
dotnet:masterfrom
jozkee:nullability_markup

Conversation

@jozkee

Copy link
Copy Markdown
Member

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

@jozkeejozkee added this to the 5.0.0 milestone Aug 28, 2020
@jozkeejozkee self-assigned this Aug 28, 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.

@jeffhandleyjeffhandley 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 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
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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=newXmlNode[list.Count];
for(inti=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
Copy Markdown
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?

@jozkeejozkeeAug 28, 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.

Same answer as previous comment #41488 (comment).

@eerhardteerhardt 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.

:shipit:

@jozkee
jozkee merged commit 7408f1b into dotnet:masterAug 28, 2020
@jozkee
jozkee deleted the nullability_markup branch August 28, 2020 06:58
@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.

5 participants

@jozkee@krwq@jeffhandley@eerhardt@safern