TweetSharp错误无法反序列化当前的JSON数组

时间:2016-02-03 17:56:41

标签: c# asp.net json twitter

我正在使用TweetSharp在网站上列出推文的旧应用程序,但最近我开始收到以下错误,经过数小时的尝试后我无法解决原因

enter image description here

我有以下代码

        //get the twitter username
        TwitterUsername = SpotlightPage.Property["TwitterUsername"].ToString();

        //load tweets from the cache
        var tweets = Context.Cache["TwitterSpotlight" + TwitterUsername] as IEnumerable<TwitterStatus>;

        //If the cache doesn't exist or has expired, get the list of tweets again and set the cache
        if (tweets == null)
        {
            var service = new TwitterService(_consumerKey, _consumerSecret);
            service.AuthenticateWith(_accessToken, _accessTokenSecret);

            //set options for listing tweets
            var options = new ListTweetsOnUserTimelineOptions();

            //set the screen name to be the username
            options.ScreenName = TwitterUsername;

            // The number of tweets to display
            options.Count = 6;

            //Get the list of tweets.
            tweets = service.ListTweetsOnUserTimeline(options);

            //only if we got tweets add them to the cache
            if (tweets != null)
            {
                    //Cache the output of the tweets
                    Context.Cache.Add("TwitterSpotlight" + TwitterUsername, tweets, null, DateTime.Now.AddMinutes(5), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Normal, null);
            }
        }

        tweetdisplay.DataSource = tweets;
        tweetdisplay.DataBind();

如果我将推文数设置为&gt; 5然后我将收到上图中描述的JSON错误。这表明第6条推文中的数据可能存在问题,但我无法看到任何可能导致问题的内容。我已经阅读了其他帖子,表明表情符号/表情符号可能会导致这种行为,而肮脏的修复方法是删除推文。我只是不能删除推文,需要确保这是稳定的。

我想知道是否有人解决了这个问题?

提前致谢

0 个答案:

没有答案