Note that there are some explanatory texts on larger screens.

plurals
  1. PODataContractSerializer only partially serializing my objects
    text
    copied!<p>I am using the following code to serialize an object to XML,</p> <pre><code> StringBuilder sb = new StringBuilder(); DataContractSerializer dcr = new DataContractSerializer(query.Result.GetType()); XmlWriterSettings xws = new XmlWriterSettings() { CloseOutput = true, Encoding = Encoding.UTF8 }; dcr.WriteObject(XmlWriter.Create(sb, xws), query.Result); query.Result.ReportXml = sb.ToString(); </code></pre> <p>But I cannot get the DataContractSerializer to return complete and valid XML, for every object I try to serialize, I get 6143 characters returned.</p> <p>Here is an example of the end of the XML string that is returned,</p> <pre><code>&lt;d2p1:anyType i:type="EquipmentDO"&gt; &lt;DataObjectState&gt;Modified&lt;/DataObjectState&gt; &lt;DataObjectType&gt;Equipment&lt;/DataObjectType&gt; &lt;OwningDataManagerType&gt;Configuration&lt;/OwningDataManagerType&gt; &lt;ConfigurationManagementID i:nil="true" /&gt; &lt;ConfigurationManagerAction&gt;Nothing&lt;/ConfigurationManagerAction&gt; &lt;ConfigurationRequestUserID i:nil="true" /&gt; &lt;Id&gt;10&lt;/Id&gt; &lt;Active&gt;false&lt;/Active&gt; &lt;EquipmentModel&gt;11&lt;/EquipmentModel&gt; &lt;LineClearanceLevelIds&gt; &lt;_keys&gt; &lt;d2p1:int&gt;1&lt;/d2p1:int&gt; &lt;d2p1:int&gt;2&lt;/d2p1:int&gt; &lt;d2p1:int&gt;3&lt;/d2p1:int&gt; &lt;d2p1:int&gt;4&lt;/d2p1:int&gt; &lt;/_keys&gt; &lt;/LineClearanceLevelIds&gt; &lt;Zone&gt;5&lt;/Zone&gt; &lt;/d2p1:anyType&gt; &lt;d2p1:anyType="" i:type="EquipmentDO"&gt; &lt;DataObjectState&gt;Modified&lt;/DataObjectState&gt; &lt;D </code></pre> <p>Has anyone else experienced the capping of the resulting XML to a number of characters or can anyone point out what I am doing wrong here?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload