FilteredStream frequently stopping due to error

May 3, 2014 at 4:36 AM
I haven't created an issue because I'm not entirely sure this is unintended - but I've noticed my async streaming filter frequently stops. I added a StreamStopped event handler to get a stack trace, and I'm seeing the following stack trace:
5/2/2014 7:13:57 PMStream Stopped
Error converting value "poi" to type 'Tweetinvi.Core.Enum.PlaceType'. Path 'place.place_type', line 1, position 1996.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at Tweetinvi.Logic.JsonConverters.JsonInterfaceToObjectConverter`2.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at Tweetinvi.Logic.JsonConverters.JsonInterfaceToObjectConverter`2.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonConverter[] converters)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonConverter[] converters)
   at Tweetinvi.Logic.Wrapper.JsonConvertWrapper.DeserializeObject[T](String json, JsonConverter[] converters)
   at Tweetinvi.Logic.JsonConverters.JsonObjectConverter.DeserializeObject[T](String json, JsonConverter[] converters)
   at Tweetinvi.Factories.Tweet.TweetFactory.GenerateTweetFromJson(String jsonTweet)
   at Tweetinvi.Streams.FilteredStream.<StartStreamMatchingAllConditionsAsync>b__1b(String json)
   at Tweetinvi.Streams.Helpers.StreamResultGenerator.<>c__DisplayClass1.<StartStreamAsync>b__0(String json)
   at Tweetinvi.Streams.Helpers.StreamResultGenerator.<StartStreamAsync>d__7.MoveNext()

Anyone have any insight - whether this is a bug, or if it's expected and I should continue to handle it by restarting the stream. If there's any extra info that would help, I can try to catch this again.
Coordinator
May 5, 2014 at 8:59 PM
Hi there,

I think this is a bug. But I never received this bug before.
If this happen again would you please send me the ObjectValue from the Error when it is thrown.

If the error is not thrown directly to you you can do the following :

Debug -> Exception -> Check : Thrown for Common Language Runtime Exceptions.
If the error is still not thrown within your debug session please use the Source Code because I cannot reproduce your problem.

Regards,
Linvi
May 6, 2014 at 4:16 AM
Hello Linvi,

Thanks for the response and suggestion to break on CLR Exceptions - it took a while, but I was able to catch it again. It seems to be happening for tweets with a place.place_type value of "poi"

If it helps, I captured the jsonresponse which caused it. There's a raw version here and a beautified version here.

I'm not sure what you meant by sending the ObjectValue - but if the information above isn't enough, I'd be glad to do whatever else helps.
Coordinator
May 7, 2014 at 10:14 AM
Hi,

Thank you, this is exactly what I needed :) I will have a look at this issue tonight and probably provide a fix as well.

Linvi
Coordinator
May 7, 2014 at 11:51 PM
Hi,

Just to let you know that I have updated the Source Code of Tweetinvi 0.9.3.0. This error should not occur anymore.
You can download the latest version of the Source Code from here.

Thank you for reporting this problem and taking the time to give me the details to solve it.
The fix will be part of the release 0.9.3.0 which I hope will be completed in 1 to 2 months!
So please use the source code during this time.

Regards,
Linvi