Fix for issue #260, Deserialize xml for Windows Phone #261

Merged
merged 1 commit into from Dec 23, 2012

2 participants

@anewton
    private static object Deserialize(string xml, Type type, XmlDictionaryReaderQuotas quotas)
    {
        try
        {

#if WINDOWS_PHONE
StringReader stringReader = new StringReader(xml);
using (var reader = XmlDictionaryReader.Create(stringReader))
{
var serializer = new DataContractSerializer(type);
return serializer.ReadObject(reader);
}
#else

@anewton

I discovered an error in the way the ServiceStack.Text Deserialize method works on Windows Phone. It passes in xml as a string to create the XmlDictionaryReader. The create method thinks the string is a Uri and then can't find the file. So it needs to create a StringReader object first and then it can create correctly.

@mythz mythz merged commit a2e297d into ServiceStack:master Dec 23, 2012
@mythz
ServiceStack member

Cool, thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment