"JsonData instance doesn't hold an int" with Count paremeter of Search

Oct 22, 2013 at 8:50 AM
When using Search function, I get "JsonData instance doesn't hold an int" error. I didn't get that error yesterday. I think Twitter has made some change on "GET search/tweets" api call. When I comment-out the Count line, there is no exception thrown. But when I set Count, I get the exception above.
List<Status> userStatusResponse =
                            (from search in twitterCtx.Search
                             where search.Type == SearchType.Search
                                   && search.Query == hashtagName
                                   && search.SinceID == sinceID
                                   && search.Count == Count
                             select search)
                            .FirstOrDefault().Statuses;
Hope you'll update this soon Joe. Thanks in advance.
Oct 22, 2013 at 2:28 PM
Bump, I'm having the same problem!
Coordinator
Oct 22, 2013 at 2:56 PM
Hi,

I've fixed this and deployed a new version of LINQ to Twitter, v2.1.10. This is to support Twitter's new 64-bit user IDs. Please update to v2.1.10.

@JoeMayo
Oct 22, 2013 at 3:00 PM
Thanks for quick response man. I think you should deploy it on Nuget too, because most people tend to use Nuget more often and this seems like an important detail :)
Coordinator
Oct 22, 2013 at 3:20 PM
It's deployed to NuGet too. Sometimes NuGet takes a few minutes to update.

@JoeMayo
Oct 22, 2013 at 3:38 PM
Yeah I just saw it, thanks Joe.
Oct 22, 2013 at 4:41 PM
Hi Joe,
it's working great with search but still not working with stream, i know twitter API changed cash from string to uLong. could you please update it also in stream
Coordinator
Oct 22, 2013 at 5:18 PM
ahmed_ashmawy wrote:
Hi Joe,
it's working great with search but still not working with stream, i know twitter API changed cash from string to uLong. could you please update it also in stream
What is "cash"? I don't understand.

@JoeMayo
Oct 22, 2013 at 5:25 PM
sorry i mean cache_age
Coordinator
Oct 22, 2013 at 5:43 PM
ahmed_ashmawy wrote:
sorry i mean cache_age
Now I see. The only thing I know about cache_age is that it's a property on the EmbeddedStatus, which is returned through a Status/Oembed query. At one time, Twitter API had switched that to a ulong and it broke the code, but they quickly switched it back to string. Here's a discussion on that:

https://dev.twitter.com/discussions/18067

You mentioned something about the Stream though. LINQ to Twitter just returns the JSON data from Twitter, so I'm not sure where cache_age comes into play there. Are you using another library to parse the JSON from your stream? Maybe you could show some code that demonstrates where the problem occurs?

@JoeMayo
Oct 22, 2013 at 5:55 PM
you right i tested it again and its working fine now just restated visual studio
Nov 7, 2013 at 12:26 PM
Edited Nov 7, 2013 at 12:29 PM
Hi Joe,

I am too getting same error when i'm fetching details of the followers from an authenticated user account.
Here is the error: JsonData instance doesn't hold an int.
This was working fine earlier. I have updated with latest version v2.1.10 and restarted VS2010.
        var twitterCtx = new TwitterContext(auth1);

                var followers = (from follower in twitterCtx.SocialGraph where follower.Type == SocialGraphType.Followers && follower.ScreenName == Convert.ToString(Session["SOCIAL_NETWORKING_USERScreenName"]) select follower).SingleOrDefault();

                foreach (var id in followers.IDs)
                {
                    string UsrId = id;
                    var user = (from account in twitterCtx.User
                                     where account.Type == UserType.Show &&
                                           account.UserID == UsrId
                                     select account).SingleOrDefault();
        ......
        ......

        }
Can u please confirm if it is fixed in the newer version?

Thanks
Coordinator
Nov 7, 2013 at 3:21 PM
Yes, it is fixed in the latest version.
Nov 8, 2013 at 2:00 PM
Hi All, I was getting this error, but when I have upgraded my code with latest version of Linq To Twitter(v2.1.10), it started giving me compilation error in VS 2012.

Following are the error:

Error 8 The type or namespace name 'UserMention' could not be found (are you missing a using directive or an assembly reference?)
Error 9 The type or namespace name 'UserMention' could not be found (are you missing a using directive or an assembly reference?)
Error 10 'LinqToTwitter.Entities' does not contain a definition for 'HashTagMentions' and no extension method 'HashTagMentions' accepting a first argument of type 'LinqToTwitter.Entities' could be found (are you missing a using directive or an assembly reference?)
Error 11 'LinqToTwitter.Entities' does not contain a definition for 'UserMentions' and no extension method 'UserMentions' accepting a first argument of type 'LinqToTwitter.Entities' could be found (are you missing a using directive or an assembly reference?)
Error 12 'LinqToTwitter.Entities' does not contain a definition for 'HashTagMentions' and no extension method 'HashTagMentions' accepting a first argument of type 'LinqToTwitter.Entities' could be found (are you missing a using directive or an assembly reference?)
Error 13 'LinqToTwitter.Entities' does not contain a definition for 'UserMentions' and no extension method 'UserMentions' accepting a first argument of type 'LinqToTwitter.Entities' could be found (are you missing a using directive or an assembly reference?)
Error 14 'LinqToTwitter.Entities' does not contain a definition for 'HashTagMentions' and no extension method 'HashTagMentions' accepting a first argument of type 'LinqToTwitter.Entities' could be found (are you missing a using directive or an assembly reference?)
Error 17 The type or namespace name 'UserMention' could not be found (are you missing a using directive or an assembly reference?)
Error 18 'LinqToTwitter.Entities' does not contain a definition for 'HashTagMentions' and no extension method 'HashTagMentions' accepting a first argument of type 'LinqToTwitter.Entities' could be found (are you missing a using directive or an assembly reference?)
Error 19 'LinqToTwitter.Entities' does not contain a definition for 'UserMentions' and no extension method 'UserMentions' accepting a first argument of type 'LinqToTwitter.Entities' could be found (are you missing a using directive or an assembly reference?)


Help me out of it, it's very urgent to accomplish my task. Thanks in Advance.
Coordinator
Nov 8, 2013 at 6:31 PM
Hi,

Those were renamed to HashtagEntity, MediaEntity, SymbolEntity, and UrlEntity.

Follow @JoeMayo
Nov 9, 2013 at 7:41 AM
Hi JoeMayo,

Thanks for your instant reply, is there any documentation for the latest version of LinqToTwitter ? Please let me know.
Coordinator
Nov 9, 2013 at 9:06 AM
Not yet.
Nov 11, 2013 at 10:01 AM
I'm still getting this error on 2.1.10 in unit tests for a larger application.
{"JsonData instance doesn't hold an int"}
Code
var query =
    _service.Search
    .Where(x => x.Type == SearchType.Search)
    .Where(x => x.Query == qryStr)
    .Where(x => x.Count == rpp);
Resultant query:
https://api.twitter.com/1.1/search/tweets.json?count=100&q=%23cheese
Coordinator
Nov 11, 2013 at 11:25 AM
You probably still have a reference to the old DLL. Make sure you do a full clean/rebuild to get rid of any old references.
Nov 12, 2013 at 10:50 AM
Good catch. Clean VCS root solved the problem, thanks.