title: Why is DataSet.WriteXml occasionally writing NUL bytes to file? Can it be prevented?
body: <p>Our application has some XML setting files, the schema is in a DataSet, and the files are written with <a href="https://docs.microsoft.com/en-us/dotnet/api/system.data.dataset.writexml?view=netframework-3.5" rel="nofollow noreferrer">DataSet.WriteXml</a>.  Sometimes - though it is uncommon - the .xml files are filled with NUL (\0) bytes instead of the data and settings that are expected.  Why is this happening?  Is there any way to prevent the file from being filled with NUL bytes?</p>