using Atlassian.SDK - ver. 12.1.0
Hey,
I'm trying to use Jira Api to get all the Issues of a certain type. I'm successfully able to connect to the endpoint and get my results using the method GetIssuesFromJqlAsync, but when I start to iterate through the list of issues it only goes as far as the first 8 issues after that I get the exception "System.NullReferenceException: 'Object reference not set to an instance of an object.'". I'm using a maximum of 100 items per request, but I never get that far.
This should be a simple call and it's really killing my time. Have we got any solution or workaround?
This is my method:
public static async Task<IPagedQueryResult<Issue>> GetIssues(int startAt)
{
var jira = Jira.CreateRestClient("url", "luser", "key", new JiraRestClientSettings());
string issuetype = "some type";
IssueSearchOptions options = new IssueSearchOptions($"type = \"{issuetype}\"");
options.MaxIssuesPerRequest = 100;
options.StartAt = startAt;
return await jira.Issues.GetIssuesFromJqlAsync(options);
}
This is how I'm calling it:
IPagedQueryResult<Issue> pagedQueryResult = Task.Run(() => GetIssues(0)).GetAwaiter().GetResult();
This is how I'm iterating:
foreach (Issue issue in pagedQueryResult)
{
// I do something
}
I really appreciate some help here.
Worked around debugging your Atlassian.SDK solution, Thank you for sharing, it was very useful.
What was the solution in the end? This is also killing me! :)
- Andy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andyif you enable the EnableUserPrivacyMode setting on the Jira Client, you should be able to enumerate the Jira issues without any problems. Apparently, the API wrapper does not handle the case where, due to privacy settings, some properties are not returned by the REST API, causing the error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.