dotnet / dotnet/dotnet-api-docs

Load(XmlReader) when XmlReader was newly created with .ReadSubtree()

Open
#975 0 comments 0 reactions 0 assignees View on GitHub
area-System.Xml dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Documentation should note that when calling XElement.Load(subReader) where subReader was previously created with subReader= myReader.ReadSubtree() you may receive an error "The XmlReader state should be EndOfFile after this operation.".

To work around this problem, you can call XElement.Load(subReader.ReadSubtree())

See: https://stackoverflow.com/a/5510781

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 7a68c44a-8022-ea78-b925-8c9f3bb84086
* Version Independent ID: 7daa0c33-a14d-5f14-8ece-b85903f94d0e
* Content: [XElement.Load Method (System.Xml.Linq)](https://docs.microsoft.com/en-us/dotnet/api/system.xml.linq.xelement.load?view=netframework-4.7.2)
* Content Source: [xml/System.Xml.Linq/XElement.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Xml.Linq/XElement.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.