System.FormatException: Input string was not in a correct format.

Mar 31, 2010 at 7:24 AM
Edited Mar 31, 2010 at 7:25 AM

This is the error I get:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error: 

Line 53: 
Line 54:             //If user hasn't added application he'll be redirected to add application
Line 55:             if (WebCommon.FacebookApi.Users.GetInfo() == null)
Line 56:             {
Line 57:                 Response.Redirect(@"~\login.aspx");
I suspect facebook have changed their api. This means the developers toolkit needs to be updated as well, right?
Mar 31, 2010 at 7:38 AM

i just notice this too.  my code was working just fine earlier today.  can someone confirm that facebook changed their api?

Mar 31, 2010 at 7:41 AM

Is there any instant way to contect the toolkit developers?

Mar 31, 2010 at 8:05 AM

I'm going to try rebuilding the toolkit tomorrow (3/31).  If I succeed, I'll post my results here. 

My code was working fine earlier today (3/30) but stopped mid day in the same location as vondiplo found it.

Funny thing about the problem is that I could see the problem "ripple" through as FB rolled the change out to all of their servers.

Mar 31, 2010 at 8:26 AM

not sure if this is helpful but this is what i get when i go to my Facebook app which was working on monday.


Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +10162339
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +207
   System.Xml.XmlConvert.ToInt32(String s) +51
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderusers_getInfo_response.Read9_hs_info(Boolean isNullable, Boolean checkType) +894
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderusers_getInfo_response.Read19_user(Boolean isNullable, Boolean checkType) +1482
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderusers_getInfo_response.Read20_users_getInfo_response(Boolean isNullable, Boolean checkType) +712
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderusers_getInfo_response.Read21_users_getInfo_response() +130

[InvalidOperationException: There is an error in XML document (47, 7).]
   System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +1479
   System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream) +252
   Facebook.Utility.Utilities.DeserializeXML(String xmlInput) +313

[FacebookException: Could not deserialize data returned from server]
   Facebook.Utility.Utilities.DeserializeXML(String xmlInput) +457
   Facebook.Rest.RestBase.SendRequest(IDictionary`2 parameterDictionary, Boolean useSession) +79
   Facebook.Rest.Users.GetInfo(String uids, Boolean isAsync, GetInfoCallback callback, Object state) +404
   Facebook.Rest.Users.GetInfo(Int64 uid) +66
   _Default.Page_Load(Object sender, EventArgs e) +33
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428



the code for the page is this:


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

public partial class _Default : CanvasIFrameBasePage
    public string InitParams { get; set; }

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

    protected void Page_Load(object sender, EventArgs e)
        user thisUser = Api.Users.GetInfo();
        InitParams = string.Format("uid={0},name={1},pic={2},sex={3},birthday={4},profile={5}", thisUser.uid,, thisUser.pic_square,, thisUser.birthday, thisUser.profile_url);

    /// <summary>
    /// In IE, if a parent frame has a different domain than the child page, the session data 
    /// (stored in the Session object) is not preserved as a security precaution.
    /// </summary>
    /// <param name="e"></param>
    protected override void OnPreRender(EventArgs e)
        Response.AppendHeader("P3P", "CP=\"CAO PSA OUR\"");


Mar 31, 2010 at 8:41 AM

That confirms that we are all seeing the same issue.  I just downloaded that latest Facebook.xsd and it looks like there may be significant differences but I won't really know until I start building it.


Mar 31, 2010 at 8:41 AM

Good luck ,please inform if you need help.

Mar 31, 2010 at 12:11 PM
Hi all, Any help yet, about the above server error which fires when you are using "Api.Users.GetInfo()" method ? Appreciate fast response ...
Mar 31, 2010 at 12:38 PM

Check my reply in the issues section

Mar 31, 2010 at 4:25 PM

Looks to be fixed with new binaries AND the solution was docmented...


Here is the fix:

recompile the binaries from source with the following members and their referencing properties set to set to int?

These are members of > Facebook.Schema.hs_info

private int? grad_yearField;
private int? hs1_idField;
private int? hs2_idField;

If you don't have the capability or need to get your site running ASAP.. i've attached the binaries with this change already compiled in.

~Lucas Smolic


Mar 31, 2010 at 5:21 PM

Our apps were all broken also.  Facebook did make a change and it only affects .net library because of our static nature.  Going to have to go through code and try to figure out best way to mitigate this issue in the future when they decide to change things like this.

I just checked in the fix and the changeset is 48893

We are redeploying all of our apps now. :(

Mar 31, 2010 at 6:28 PM

Per Lucas's fix, the source tree has been updated to 48896

Thanks Lucas!  We are updating apps now. :)