public void addAttachment(string issueKey, string filename, IBinaryContainer attachment) { checkCredentials(); try { jira.addBase64EncodedAttachmentsToIssue(credentials, issueKey, new string[] { filename }, new string[] { attachment.ToBase64String(Base64FormattingOptions.InsertLineBreaks) }); } catch (Exception ex1) { LOG.WarnFormat("Failed to upload by using method addBase64EncodedAttachmentsToIssue, error was {0}", ex1.Message); try { LOG.Warn("Trying addAttachmentsToIssue instead"); jira.addAttachmentsToIssue(credentials, issueKey, new string[] { filename }, (sbyte[])(Array)attachment.ToByteArray()); } catch (Exception ex2) { LOG.WarnFormat("Failed to use alternative method, error was: {0}", ex2.Message); throw; } } }