Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

Allen Demis Bellot
Allen
    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

Allen

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.

Demis Bellot mythz merged commit a2e297d into from
Demis Bellot
Owner

Cool, thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 23, 2012
  1. Allen

    Fix for issue #260 Deserialize method in ServiceStack.Text/XmlSeriali…

    anewton authored
    …zer.cs for windows phone.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/ServiceStack.Text/XmlSerializer.cs
3  src/ServiceStack.Text/XmlSerializer.cs
View
@@ -36,7 +36,8 @@ private static object Deserialize(string xml, Type type, XmlDictionaryReaderQuot
try
{
#if WINDOWS_PHONE
- using (var reader = XmlDictionaryReader.Create(xml))
+ StringReader stringReader = new StringReader(xml);
+ using (var reader = XmlDictionaryReader.Create(stringReader))
{
var serializer = new DataContractSerializer(type);
return serializer.ReadObject(reader);
Something went wrong with that request. Please try again.