System.Xml.XmlException: There is no Unicode byte order mark. Cannot switch to Unicode.

System.Xml.XmlException: There is no Unicode byte order mark. Cannot switch to Unicode.

传递给函数的路径是Load file C:\workspace\GitHub\ChuckLu\ChuckFork\FatAntelope\FatAntelope.CommandLine\bin\Debug\..\..\..\ConsoleApp1\sample\source.xml failed.

应该需要用GetFullPath处理一下

<?xml version="1.0" encoding="utf-8"?> 文件开头的编码和文件本身保存的编码不匹配,所以报错

原文地址:https://www.cnblogs.com/chucklu/p/15656500.html