[Solved] System.Xml.XmlException: Unexpected XML declaration. The XML declaration must be the first


Make sure your <?xml tag is the first thing in the document (and that it doesn’t have anything before that, this includes whitespace).
You can have <?xml only once per document, so if you have a large chunk of XML and you have this tag repeated somewhere down the lines your document won’t be valid.

solved System.Xml.XmlException: Unexpected XML declaration. The XML declaration must be the first