Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

XmlException in XmlSerializer.Deserialize when XML has \0

Language: Editor: Layout:
+ ] Show input
Compilation time: 0,16 sec, absolute running time: 0,7 sec, cpu time: 0,72 sec, average memory usage: 24 Mb, average nr of threads: 7 
edit mode |  history  | discussion
Error(s):
Exception in user code:

System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 3, position 26.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ParseNumericCharRefInline(Int32 startPos, Boolean expand, StringBuilder internalSubsetBuilder, Int32& charCount, EntityType& entityType)
   at System.Xml.XmlTextReaderImpl.ParseCharRefInline(Int32 startPos, Int32& charCount, EntityType& entityType)
   at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
   at System.Xml.XmlTextReaderImpl.ParseText()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderTeste.Read2_Teste(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderTeste.Read3_Teste()

System.InvalidOperationException: There is an error in XML document (3, 26).
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
   at Rextester.Program.DeserializeObject[T](String txt)
   at Rextester.Program.Main(String[] args)
Hello, world!