This project has moved and is read-only. For the latest updates, please go here.

Urgent ! Terminating Exception with latest version

Aug 24, 2012 at 6:50 PM

Hi Joe,

I use the latest nuget paquage version and when I use the Search a word with this query:
       var res = (from search in twitterCtx.Search           where search.Type == SearchType.Search &&                 search.ShowUser == true &&                 search.IncludeEntities == true &&                 search.ResultType == ResultType.Mixed &&                 search.PageSize == rpp &&                  search.SearchLanguage ==  lang.ToString() &&                 search.Query == query && search.GeoCode == geoCode            select search).Single(); 

I often get an error which make my WPF app crashes. This is strange because my app contains 3 kind of unhandled error handler but and I have Try-Catch surrounding the query.

[10416] Trace Error:[10416] - System.Collections.ListDictionaryInternal::Sequence contains no elements||   at LinqToTwitter.TwitterQueryProvider.Execute[TResult](Expression expression) [10416]    at System.Linq.Queryable.Single[TSource](IQueryable`1 source) 

This is not happening all the time during all refresh but often.

Hope you can figure out what is going on.

Txs for your help.



Aug 24, 2012 at 6:57 PM

Hi Vince,

Try .SingleOrDefault() instead of .Single() and check the result for null before trying to use it.