@joebigelow / wix-1 / commits / 80304dda

Fix persisting of WindowsInstallerData by minimizing compliance checks

Support storing characters such as NULL that are technically invalid in XML text but can be escaped properly if settings are set just right. Also, skip the XML declaration that wastes space.

Rob Mensching committed Jul 19, 2020 at 01:21 UTC 80304ddaf48d843e9d6971d2e44f84bb096d494b
1 file changed +7 -1
src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
+7 -1
@@ -18,6 +18,12 @@ namespace WixToolset.Data.WindowsInstaller
18
19 private static readonly Version CurrentVersion = new Version("4.0.0.0");
20 private const string WixOutputStreamName = "wix-wid.xml";
21 + private static readonly XmlWriterSettings WriterSettings = new XmlWriterSettings
22 + {
23 + CheckCharacters = false,
24 + CloseOutput = false,
25 + OmitXmlDeclaration = true,
26 + };
27
28 /// <summary>
29 /// Creates a new empty output object.
@@ -83,7 +89,7 @@ namespace WixToolset.Data.WindowsInstaller
89 /// <param name="wixout">Container to save to.</param>
90 public void Save(WixOutput wixout)
91 {
86 - using (var writer = XmlWriter.Create(wixout.CreateDataStream(WixOutputStreamName)))
92 + using (var writer = XmlWriter.Create(wixout.CreateDataStream(WixOutputStreamName), WriterSettings))
93 {
94 this.Save(writer);
95 }