Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit 19f0059

Browse files
committed
Added workaround to XML serializer breaking changes in Net 4.x
1 parent 1bbb287 commit 19f0059

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Node_Editor/Default/IO Formats/XMLImportExport.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,10 @@ private XmlElement SerializeObjectToXML(XmlElement parent, object obj)
355355
XmlSerializer serializer = new XmlSerializer(obj.GetType());
356356
XPathNavigator navigator = parent.CreateNavigator();
357357
using (XmlWriter writer = navigator.AppendChild())
358+
{ // Workaround: XMLSerializer now always calls WriteStartDocument when writer is unused - even though it's a fragment - and will throw an error...
359+
writer.WriteWhitespace("");
358360
serializer.Serialize(writer, obj);
361+
}
359362
return (XmlElement)parent.LastChild;
360363
}
361364
catch (Exception)

0 commit comments

Comments
 (0)