Description
sample
public class StringContainer
{
public string String { get; set; }
}
[Fact]
public void Test()
{
var serializer = new XmlSerializer(typeof(StringContainer));
var expected = new StringContainer
{
String = "Sample\0Text"
};
var stream = new MemoryStream();
serializer.Serialize(stream, expected);
stream.Position = 0;
var actual = (StringContainer)serializer.Deserialize(stream); // <-- exception
}
it would be nice, if the exception would occur at serialization, because its a pita when it happens at deserialization with huge streams (ex There is an error in XML document (54563, 98).
)