Log and restore XmlNodeType in XmlNodeReader#124559
Log and restore XmlNodeType in XmlNodeReader#124559lilinus wants to merge 3 commits intodotnet:mainfrom
Conversation
....Xml/tests/XmlNodeReader/System.Xml.XmlNodeReader.Tests/XmlNodeReaderMoveToAttributeTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
| XmlNodeReader nodeReader = NodeReaderTestHelper.CreateNodeReader(xml); | ||
| Assert.True(nodeReader.ReadToDescendant("child")); | ||
| Assert.True(nodeReader.MoveToAttribute("attr1")); | ||
| Assert.False(nodeReader.MoveToAttribute("attr2")); | ||
| nodeReader.ReadStartElement("child"); | ||
| } |
There was a problem hiding this comment.
The new regression test verifies success by calling ReadStartElement, but it doesn’t directly assert the reader state after MoveToAttribute("attr2") returns false. To better lock in the intended fix (reader position must be unchanged), add assertions that NodeType/Name (and/or Depth) are still those of the existing attribute (e.g., still on attr1) before calling ReadStartElement.
🤖 Copilot Code Review — PR #124559Holistic AssessmentMotivation: The bug is real and well-documented. When Approach: The fix correctly identifies the root cause: Summary: ✅ LGTM. The fix is correct, minimal, and follows the existing log/rollback pattern. All call sites for Detailed Findings✅ Correctness — Fix properly restores
|
Fixes #34443