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.
MSDN says: The loading functionality of LINQ to XML is built upon XmlReader.Therefore, you might catch any exceptions that are thrown by the XmlReader. Create overload methods and the XmlReader methods that read and parse the document.
http://msdn.microsoft.com/en-us/library/756wd7zs.aspx
ArgumentNullException and SecurityException
EDIT: MSDN not always says true. So I’ve analyzed Load method code with reflector and got results like this:
Method Load is calling method:
Lines with exceptions possibility are commented
We could get the next exceptions:ArgumentNullException, XmlException and InvalidOperationException.
MSDN says that you could get SecurityException, but perhaps you can get this type of exception while creating XmlReader.