I just came across this issue. Instead of using your own XmlSerializer instance, you have to use the WriteXml() and ReadXml() methods on a TableContinuationToken instance.
public static string SerializeToken(TableContinuationToken token)
{
string serialized = null;
if (token != null)
{
using (var writer = new StringWriter())
{
using (var xmlWriter = XmlWriter.Create(writer))
{
token.WriteXml(xmlWriter);
}
serialized = writer.ToString();
}
}
return serialized;
}
public static TableContinuationToken DeserializeToken(string token)
{
TableContinuationToken contToken = null;
if (!string.IsNullOrWhiteSpace(token))
{
using (var stringReader = new StringReader(token))
{
contToken = new TableContinuationToken();
using (var xmlReader = XmlReader.Create(stringReader))
{
contToken.ReadXml(xmlReader);
}
}
}
return contToken;
}
I assume this is because of the serialization attributes on the class and properties, but I have not verified that. I only know that the provided code is the solution.