Could not deserialize data returned from server - Binaries don't fix this

Apr 6, 2010 at 5:40 PM

Hi Everyone,

I am fairly new to developing facebook applications, but simply cannot get my code to work using the c# library.

I am developing a FBMLCanvas application, using the Master page method that is in most of the tutorials online.

I am getting the "Could not deserialize data returned from server" error as I have seen others have on the boards, but I have used the latest binaries and the problem is still persisting. I have downloaded the 49014 build, and it is still not working...

Could it be possible that this is a server issue on my side? If so, how will I be able to address the issue?

my code looks something like (the line of code that causes the exception is highlighed):


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook.Schema;

namespace FacebookFMBL
    public partial class Default : System.Web.UI.Page

        public user LoggedInUser
                return Master.Api.Users.GetInfo();

        protected void Page_PreInit(object sender, EventArgs e)
            Master.RequireLogin = true;

        protected void Page_Load(object sender, EventArgs e)
            Master.selected = "tab_home";

        protected void submit_click(object sender, EventArgs e)
                litMessage.Text =;
            catch (Exception ex)
                litErrorMessage.Text = ex.Message;
                litStack.Text = ex.StackTrace;


Error: Could not deserialize data returned from server
Stacktrace: at Facebook.Utility.Utilities.DeserializeXML[T](String xmlInput) at Facebook.Rest.RestBase.SendRequest[T](IDictionary`2 parameterDictionary, Boolean useSession, Boolean useJson) at Facebook.Rest.Users.GetInfo(String uids, Boolean isAsync, GetInfoCallback callback, Object state) at Facebook.Rest.Users.GetInfo(Int64 uid) at Facebook.Rest.Users.GetInfo() at FacebookFMBL.Default.get_LoggedInUser() at FacebookFMBL.Default.submit_click(Object sender, EventArgs e)



Apr 6, 2010 at 6:54 PM
Make sure you download the latest from the source tree to make sure, beta 3.1 Also check to see what xml is returning from facebook. We are not seeing any issues with our apps which are live.
Apr 12, 2010 at 9:24 PM

I just got the 3.1 BETA and am getting the same "Could not deserialize data returned from server" error when calling:


IList<album> albums = _facebookAPI.Photos.GetAlbums();


Apr 12, 2010 at 9:29 PM

I managed to sort out the reason why I was getting the exception, it was not anything related to the SDK.

It turned out that my internal firewall (barracuda) was blocking any information coming from Facebook, adding Facebook to the list of acceptable sites removed the error from happening and it has been smooth sailing since.

I have noticed a couple of threads that mention the error with the .GetAlbums() method call, but personally I have not had the need for that in my current application.

Best of luck,


Apr 12, 2010 at 9:32 PM

Well, this is the XML coming back


<?xml version="1.0" encoding="UTF-8"?>
<photos_getAlbums_response xmlns="" xmlns:xsi="" xsi:schemaLocation="" list="true">
    <name>Profile Pictures</name>
    <created  xsi:nil="true"/>
    <modified  xsi:nil="true"/>
    <description xsi:nil="true"/>
    <location xsi:nil="true"/>
    <modified_major  xsi:nil="true"/>

It's failing on the line:

return (T)xs.Deserialize(memoryStream);



Apr 12, 2010 at 9:46 PM
Edited Apr 12, 2010 at 9:52 PM

Some more information on this error. The actual exception error is:


{System.InvalidOperationException: There is an error in XML document (16, 6). ---> System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.Xml.XmlConvert.ToInt64(String s)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderphotos_getAlbums_response.Read2_album(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderphotos_getAlbums_response.Read3_photos_getAlbums_response(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderphotos_getAlbums_response.Read4_photos_getAlbums_response()
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
   at Facebook.Utility.Utilities.DeserializeXML[T](String xmlInput)}


Facebook API states that this is an example of what the XML should look like when coming back:


<?xml version="1.0" encoding="UTF-8"?>
 <photos_getAlbums_response xmlns=""
  xsi:schemaLocation="" list="true">
    <name>Films you will never see</name>
    <description>No I will not make out with you</description>
    <location>York, PA</location>


Apr 12, 2010 at 10:29 PM

This is a known issue due to there not being a profile photo. Issue reopened here: