Twitterizer TwittterTimeline NewtonSoft.JSON.JsonSerializationException problems

1.6k views Asked by At

The following code throws a NewtonSoft.JSON.JsonSerializationException {"Unexpected token when deserializing object: StartObject. Line 1, position 1884."}

Twitterizer version :2.4.0.26532 NewtonSoft.Json = 4.0.7.0 (installed using the Nu-GET add in in visual studio)

Is there something I'm missing or dont't get?

   class Program
    {
        static void Main(string[] _args)
        {
            Logger.Write("Calling Twitter", Constants.TWITTER_AGREGATOR_LOG_CATEGORY);

            UserTimelineOptions options = new UserTimelineOptions();
            options.ScreenName = "as_tuce2";
            TwitterResponse<TwitterStatusCollection> tweets = TwitterTimeline.UserTimeline(options);   //throws exception


            OAuthTokens tokens = new OAuthTokens();
            tokens.AccessToken = // removed...
            tokens.AccessTokenSecret = // removed...
            tokens.ConsumerKey =  // removed...
            tokens.ConsumerSecret = // removed...

            UserTimelineOptions userOptions = new UserTimelineOptions();
            userOptions.IncludeRetweets = false;
            userOptions.ScreenName = "as_tuce2";
            userOptions.UseSSL = true;
            userOptions.Count = 20;


            TwitterResponse<TwitterUser> showUserResponse = TwitterUser.Show(tokens, "as_tuce2");            //ok
            TwitterResponse<TwitterStatusCollection> timelineResponse = TwitterTimeline.UserTimeline(tokens);  //throws exception


            Console.ReadLine();
        }
    }

stack trace:

at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, String id) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 1238 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateAndPopulateObject(JsonReader reader, JsonObjectContract contract, String id) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 956 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 433 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 236 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueNonProperty(JsonReader reader, Type objectType, JsonContract contract, JsonConverter converter) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 221 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IWrappedCollection wrappedList, JsonReader reader, String reference, JsonArrayContract contract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 794 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.<>c_DisplayClass1.<CreateAndPopulateList>b_0(IList l, Boolean isTemporaryListReference) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 744 at Newtonsoft.Json.Utilities.CollectionUtils.CreateAndPopulateList(Type listType, Action2 populateList) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Utilities\CollectionUtils.cs:line 233 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateAndPopulateList(JsonReader reader, String reference, JsonArrayContract contract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 732 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String reference) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 495 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 238 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueNonProperty(JsonReader reader, Type objectType, JsonContract contract, JsonConverter converter) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 221 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 117 at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonSerializer.cs:line 421 at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonSerializer.cs:line 413 at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 732 at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 694 at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 651 at Twitterizer.Core.SerializationHelper1.Deserialize(Byte[] webResponseData, DeserializationHandler deserializationHandler) at Twitterizer.Core.TwitterCommand1.ExecuteCommand() at Twitterizer.Core.CommandPerformer.PerformAction[T](ICommand1 command) at Twitterizer.TwitterTimeline.UserTimeline(OAuthTokens tokens, UserTimelineOptions options) at Twitterizer.TwitterTimeline.UserTimeline(UserTimelineOptions options)

1

There are 1 answers

0
Ricky Smith On BEST ANSWER

Thanks for posting this. I'll have to take a look at it and figure out what the new version of json.net changed.

For posterity, here is the forums topic where you reported the bug there, too.