Facebook USERID overflows Int32?

May 10, 2009 at 12:10 PM

Hi all,

 

I have a facebook app (not submitted to the directory yet), and I have been using it for a while. Recently I created a new facebook account, and it crashes with the message below.

I suspect that Int32 is not enough to store the values for Facebook User IDs being generated these days (which are ten digits long now).

Any idea if this is the case, or is it something else that I am doing wrong?

 

Value was either too large or too small for an Int32.

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.OverflowException: Value was either too large or too small for an Int32.

 

 

[OverflowException: Value was either too large or too small for an Int32.]
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +7469443
facebook.web.BasePageHelper.EstablishSession(String sessionKey, String userId, String authToken, Boolean retry) +378
facebook.web.BasePageHelper.LoadIFramePage() +240
facebook.web.BasePageHelper.LoadIFramePage(API FaceBookAPI, Boolean useSession, Boolean autoAdd, HttpRequest request, HttpResponse response, HttpSessionState session) +121
facebook.web.CanvasIFrameMasterPage.Page_Init(Object sender, EventArgs e) +67
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnInit(EventArgs e) +99
System.Web.UI.UserControl.OnInit(EventArgs e) +77
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolea

 

 

Jun 2, 2009 at 7:34 AM

It's a bug in facebook.web.dll...

private void EstablishSession(string sessionKey, string userId, string authToken, bool retry)
{
try
{
object obj2 = this._useSession ? this._session["SessionKey"] : this._request.Cookies["SessionKey"];
if (string.IsNullOrEmpty(sessionKey) && (obj2 != null))
{
sessionKey = this._useSession ? obj2.ToString() : ((HttpCookie) obj2).Value;
userId = this._useSession ? this._session["UserId"].ToString() : this._request.Cookies["UserId"].Value;
}
if (!string.IsNullOrEmpty(sessionKey))
{
this.api.SessionKey = sessionKey;
this.api.uid = Convert.ToInt32(userId); //This one causes the problem
this.SetSessionInfo(sessionKey, userId);
}
else if (!string.IsNullOrEmpty(authToken))
{
this.api.CreateSession(authToken);
this.SetSessionInfo(this.api.SessionKey, this.api.uid.ToString());
}
else
{
this.RedirectToLogin();
return;
}
this.TryAddApp();
}
catch (FacebookException exception)
{
if (exception.ErrorType == ErrorType.Timeout)
{
if (!retry)
{
throw;
}
this.ClearSessionInfo();
this.EstablishSession(null, null, authToken, false);
}
}
}
Dec 1, 2009 at 9:53 PM

Hi,

I assume that it comes from facebook.dll

Where I can download the source of facebook.dll?

Thanks

Dec 2, 2009 at 5:01 AM

Hi Yuba

This bug arose when face book users crossed the Int 32 max limit.

Right now facebook uses Int 64 to store user id.

This bug has been fixed long back.

More details and link to download facebook sdk (supported by Microsoft)

http://msdn.microsoft.com/en-us/windows/ee388574.aspx