XmlWriter always writes a Byte Order Mark (BOM) to the underlying data stream; however, some streams must not have a BOM. To omit the BOM, create a new XmlWriterSettings object and set the Encoding property to be a new UTF8Encoding object with the Boolean value in the constructor set to false.
See https://github.com/googlesamples/unity-jar-resolver/issues/425 This fixes the problem for git fighting with the BoM. From the Microsoft documentation: