Skip to content

XNodeReader.GetAttribute(int) should throw on invalid indices #44287

@krwq

Description

@krwq

Note: this class is internal but this method is accessible through XmlReader's public surface which can be created with i.e. XNode.CreateReader.

All XmlReader implementations except XNodeReader throw ArgumentOutOfRangeException on invalid indices. This specific class returns null though. Documentation of XmlReader says that ArgumentOutOfRange is expected behavior.

Also same method returns null when reader state is not in interactive mode - likely this should be replaced with InvalidOperationException.

Found with nullable annotations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Xmlgood first issueIssue should be easy to implement, good for first-time contributors

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions