You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to me that TvDbSharper.SeriesExtendedRecordDto.AverageRuntime needs to be of type int? rather than int.
I thought about submitting a pull request (which I have never done before). However, it appears that this class is generated code...so, applying a manual fix seems not to be the right thing to do. I am guessing that the class needs be regenerated, in some way.
I don't know much about JSON schema...the schema indicates that averageRuntime is an int. I don't know how we are supposed to know that this may be nullable.
Anyway, I hope it is useful that I have raised this issue because the issue results in the following exception for my code:
Newtonsoft.Json.JsonSerializationException
HResult=0x80131500
Message=Error converting value {null} to type 'System.Int32'. Path 'data.averageRuntime', line 1, position 617.
Source=Newtonsoft.Json
StackTrace:
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.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.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at TvDbSharper.TvDbClient.Parse[T](Int32 statusCode, String responseJson)
at TvDbSharper.TvDbClient.<Get>d__12`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Picks03a.Database.Repository.TheTvDbReferenceRepository.<GetTvSeriesAsync>d__7.MoveNext() in C:\gitrepos\picks03c-webapi\src\Picks03a.Database\Repository\TheTvDbReferenceRepository.cs:line 85
The text was updated successfully, but these errors were encountered:
This issue has been occurring for me for the last several days. Then, today, I tried again, and it is no longer occurring. At least not for television series with id "402602". When I retry a GET of this URL, now: https://api4.thetvdb.com/v4/series/402602/extended
...the result includes a non-null averageRuntime value, like so:
OK, I have had a closer look at this now. I can see how the code generator works. It seems to me that SeriesExtendedRecordDto.AverageRuntime needs to be nullable. I have created a pull request #35 to fix this issue.
Seems to be an issue related to the .NET version, which I don't believe to be a result of the code change that I made. So I'm not sure how to progress this now.
For some TV series, a JsonSerializationException occurs when calling TvDbClient.SeriesExtended() because the averageRuntime is null.
For example, this request:
https://api4.thetvdb.com/v4/series/402602/extended
...returns a response including the following:
It seems to me that
TvDbSharper.SeriesExtendedRecordDto.AverageRuntime
needs to be of typeint?
rather thanint
.I thought about submitting a pull request (which I have never done before). However, it appears that this class is generated code...so, applying a manual fix seems not to be the right thing to do. I am guessing that the class needs be regenerated, in some way.
I am guessing that this code is generated from the the TVDB API's JSON schema, like here:
https://thetvdb.github.io/v4-api/#/Series/getSeriesExtended
I don't know much about JSON schema...the schema indicates that
averageRuntime
is anint
. I don't know how we are supposed to know that this may be nullable.Anyway, I hope it is useful that I have raised this issue because the issue results in the following exception for my code:
The text was updated successfully, but these errors were encountered: