Question: What are the possible exceptions that can be thrown when `XDocument.Load(XmlReader)` is called? It is hard to follow best practices (i.e. avoiding generic try catch blocks) when the documentation fails to provide crucial information.

Thanks in advance for your assistance.

Answer: 
`XmlReader.Create(Stream)` allows two types of exceptions: [*[src]*](http://msdn.microsoft.com/en-us/library/756wd7zs.aspx "[src]")

```
XmlReader reader; // Do whatever you want

try
{
  XDocument.Load(reader);
}
catch (ArgumentNullException)
{
  // The input value is null.
}
catch (SecurityException)
{
  // The XmlReader does not have sufficient permissions 
  // to access the location of the XML data.
}
catch (FileNotFoundException)
{
  // The underlying file of the path cannot be found
}

```
I was following a tutorial about [web scraping in .NET 6 using XDocument](https://www.c-sharpcorner.com/article/easily-do-web-scraping-in-net-core-6-0/). However, when I called `XDocument.Load("...")` to load an .html page, I got the following exception:

```
System.Xml.XmlException: ''src' is an unexpected token. The expected token is '='. Line 47, position 32.'

```

So depending on what you will parse, and if you need something more permissive, perhaps another library is more suited. I went with [IronWebScraper](https://ironsoftware.com/csharp/webscraper/), which works better for the HTML I am working with.