Severity: Warning
File: src/Servy.Core/Services/ServiceExporter.cs, lines 32, 56
Description:
ExportXml uses StringWriter for XML serialization, which defaults to UTF-16. The serialized XML declaration reads <?xml version="1.0" encoding="utf-16"?>. However, File.WriteAllText(filePath, xmlString) writes the file as UTF-8 (default on .NET 5+).
A strict XML parser checking the declared encoding against the actual file encoding will reject the file.
Suggested fix:
Use XmlWriter with XmlWriterSettings { Encoding = new UTF8Encoding(false) } writing directly to a FileStream, so the declaration matches the actual encoding.
Severity: Warning
File:
src/Servy.Core/Services/ServiceExporter.cs, lines 32, 56Description:
ExportXmlusesStringWriterfor XML serialization, which defaults to UTF-16. The serialized XML declaration reads<?xml version="1.0" encoding="utf-16"?>. However,File.WriteAllText(filePath, xmlString)writes the file as UTF-8 (default on .NET 5+).A strict XML parser checking the declared encoding against the actual file encoding will reject the file.
Suggested fix:
Use
XmlWriterwithXmlWriterSettings { Encoding = new UTF8Encoding(false) }writing directly to aFileStream, so the declaration matches the actual encoding.