I have a C# application developed using ASP.NET MVC framework. The application uses the JIRA Cloud API for integrating with JIRA and using some of the JIRA functionality like creating/updating issues, changing the issue status and downloading the issue attachments. Recently I upgraded the JIRA API version from 5.5.1 to 10.2.1. I am using basic authentication for connecting to JIRA.
Jira jiraConn = Jira.CreateRestClient(m_JiraUrl, m_Username, m_Password);
Using the jiraConn object, I can fetch all the data that I require like issues and attachments. I get the attachment object using
Issue issue = jiraConn.Issues.GetIssueAsync(issueKey).Result;
IEnumerable<Attachment> attachments = issue.GetAttachmentsAsync().Result;
Attachment file = attachments.OrderByDescending(f => f.CreatedDate).First();
which works fine.
However when I try to download the actual attachment using
file.Download(path);
the process does not complete. It starts downloading the attachment because a file is created in the given path. It takes a few minutes(which is unusual) for the file to get populated with partial data. However, the process does not complete because the download method never returns and is stuck trying to complete the process of fetching the entire data. I suspect there is something that is blocking the download method, but I cannot figure out what exactly. Any help with this issue is highly appreciated.