Format Exception retrieving tweets (with localisation)

Apr 26, 2011 at 5:52 PM
Edited Apr 26, 2011 at 7:09 PM

Hi !

Idon't know why, randomly (and now, every time...), I get a string format exception when i'm trying to get the tweets :


 var tweets =
                  from tweet in twitterCtx.Status
                  where tweet.Type == StatusType.Home
                  && tweet.Page == numPage
                  select tweet;

 gridViewTweets.DataSource = tweets;


Some it works, some time it doesn't.


On the databind, I get a TargetInvocationException and when I view the details I got for the Inner Exception : Input string was not in a correct format.

What can I do ? I tried to put mu list "tweets" in a foreach and the error is the same I don't know why.


EDIT : I found that it may be a status that cause the error because if I ask for the page 3, my tweets displays very well...


EDIT 2 : Ok so the status that caused the exception was with geolocalisation data, now, why tweets with geolocalisation fire this exception ?

Here the stack trace :


[FormatException: Le format de la cha�ne d'entr�e est incorrect.]
   System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) +9416251
   LinqToTwitter.Geometry.CreateGeometry(XElement geometry) +313
   LinqToTwitter.Place.CreatePlace(XElement place) +810
   LinqToTwitter.Status.CreateStatus(XElement status) +3030
   LinqToTwitter.StatusRequestProcessor`1.<ProcessResults>b__1(XElement statusXmlElement) +5
   System.Linq.WhereSelectListIterator`2.MoveNext() +110
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +406
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   LinqToTwitter.StatusRequestProcessor`1.ProcessResults(String responseXml) +404
   LinqToTwitter.TwitterContext.Execute(Expression expression, Boolean isEnumerable) +267

[TargetInvocationException: Une exception a �t� lev�e par la cible d'un appel.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +251
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
   LinqToTwitter.TwitterQueryProvider.Execute(Expression expression) +346
   LinqToTwitter.TwitterQueryable`1.System.Collections.IEnumerable.GetEnumerator() +33
   System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +1836
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   System.Web.UI.WebControls.GridView.DataBind() +4
   Twitinfo93422.Private.myTweets.loadTweetPage(Int32 numPage) in C:\Users\Xenon\Documents\Visual Studio 2010\Projects\Twittons_93422\Twitinfo93422\Private\myTweets.aspx.cs:128
   Twitinfo93422.Private.myTweets.Page_Load(Object sender, EventArgs e) in C:\Users\Xenon\Documents\Visual Studio 2010\Projects\Twittons_93422\Twitinfo93422\Private\myTweets.aspx.cs:58
   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.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207




Apr 26, 2011 at 8:39 PM


I recall seeing something about a bug with the coordinates, but haven't been able to reproduce the problem yet.  Do you have the StatusID from the tween where the exception occurs?



Apr 26, 2011 at 9:58 PM
Edited Apr 26, 2011 at 9:59 PM

Hi JoeMayo, thanks for your fast reply.


Here is the statusID that have geolocalisation data : 62926066628575232

I can't get it from the debugger mode, but I guess this is this one (got via twitter web site), when it was page 2, no more error.

Maybe you will need to follow the owner to see it, search for "gonzague" if you need.

Hope it helps :)


edit : so, gonzague tweeted via Foursquare, just for information.

Apr 27, 2011 at 9:37 AM

True, geolocalisation triggers an exception

Apr 27, 2011 at 4:29 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 1, 2011 at 3:34 AM

Thanks for the help in reproducing.  Until I get another release, you can download the fix here: