I get an error when deserializing a memorystream into a class if the "&" symbol appears in the xml text.
[XmlRoot(ElementName="DesEng")]
public class DesEng {
[XmlAttribute(AttributeName="unit")]
public string Unit { get; set; }
[XmlText]
public string Text{ get; set; }
}
var xmlSerializer = new XmlSerializer(typeof(T));
var temp = (T)xmlSerializer.Deserialize(ms); // error
The line on which the error appears.
<DesEng unit="per Sector">GSM/LTE Dual Mode license for Blade&AAU</DesEng>
Using XmlWriterSettings { CheckCharacters = false } result did not bring. I'm getting an error "There is an error in the XML document (229, 70)". If I change the & symbol to another, then deserialization in the class passes correctly.