title: XML Serialization of an Object Containing invalid chars
body: <p>I'm serializing an object that contains HTML data in a String Property.</p>
  
  <pre><code>Dim Formatter As New Xml.Serialization.XmlSerializer(GetType(MyObject))
  Dim fs As New FileStream(FilePath, FileMode.Create)
  Formatter.Serialize(fs, Ob)
  fs.Close()
  </code></pre>
  
  <p>But when I'm reading the XML back to the Object:</p>
  
  <pre><code>Dim Formatter As New Xml.Serialization.XmlSerializer(GetType(MyObject))
  Dim fs As New FileStream(FilePath, FileMode.Open)
  Dim Ob = CType(Formatter.Deserialize(fs), MyObject)
  fs.Close()
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>"'', hexadecimal value 0x14, is an invalid character. Line 395, position 22."
  </code></pre>
  
  <p>Shouldn't .NET prevent this kind of error, escaping the invalid characters?</p>
  
  <p>What's happening here and how can I fix it?</p>