The code attempts to deserialize the json response, giving a null reference exception

Ravesh Kumar March 17, 2020

Hi ,

I am fetching (story or sub-task) data from JIRA SDK with following nuget package 

<package id="Atlassian.SDK" version="12.1.0" targetFramework="net46" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" />
<package id="RestSharp" version="106.10.1" targetFramework="net46" /> 

I used below function to fetch the result 

IPagedQueryResult<Issue> result = await jira.Issues.GetIssuesFromJqlAsync("project = 'CREDRE' AND issuetype='Story' and updatedDate>= -4d ORDER BY id DESC", int.MaxValue);

but some some story or task it return an error giving a null reference exception.JIraIssue_2.JPGJIRAIssue1.jpg

Please see attached screens of exact issue while fetching (story or sub-task) from JIRA API.

Stack Trace error :

at Atlassian.Jira.Remote.MultiObjectCustomFieldValueSerializer.<FromJson>b__2_0(JToken j)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Atlassian.Jira.Remote.MultiObjectCustomFieldValueSerializer.FromJson(JToken json)
at Atlassian.Jira.Remote.RemoteIssueJsonConverter.<GetCustomFieldValuesFromObject>b__9_1(JProperty field)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Atlassian.Jira.Remote.RemoteIssueJsonConverter.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.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Atlassian.Jira.Remote.IssueService.<>c_DisplayClass20_0.<GetIssuesFromJqlAsync>b_2(JObject issueJson)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.SystemCore_EnumerableDebugView`1.get_Items()

1 answer

0 votes
Chetan Lohade February 20, 2024

Facing same issue. Any resolution?

Suggest an answer

Log in or Sign up to answer