Background
----------

I serialize a very large `List<string>` using this code:

```
public static string SerializeObjectToXML<T>(T item)
{
    XmlSerializer xs = new XmlSerializer(typeof(T));
    using (StringWriter writer = new StringWriter())
    {
        xs.Serialize(writer, item);
        return writer.ToString();
    }
}

```

And deserialize it using this code:

```
public static T DeserializeXMLToObject<T>(string xmlText)
{
    if (string.IsNullOrEmpty(xmlText)) return default(T);
    XmlSerializer xs = new XmlSerializer(typeof(T));
    using (MemoryStream memoryStream = new MemoryStream(new UnicodeEncoding().GetBytes(xmlText.Replace((char)0x1A, ' '))))
    using (XmlTextReader xsText = new XmlTextReader(memoryStream))
    {
        xsText.Normalization = true;
        return (T)xs.Deserialize(xsText);
    }
}

```

But I get this exception when I deserialize it:

> 
> **XMLException**: There is an error in XML document (217388, 15). '[]', hexadecimal value 0x1A, is an invalid character. Line 217388, position 15.
> 
> 
> *at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)*
> 
> 
> *at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)*
> 
> 
> 

Question
--------

**Why is the** `xmlText.Replace((char)0x1A, ' ')` **line not working**, what witchery is this?

Some Constraints
----------------

* My code is in C#, framework 4, built in VS2010 Pro.
* I can't view the value of xmlText in debug mode because the `List<string>` is too big and the watch windows just displays the  `Unable to evaluate the expression. Not enough storage is available to complete this operation.` error message.