Jira .NET SDK:issue.Savechange() 抛出未知异常

问题描述

我用来自动创建 Jira 问题的 .NET 程序最近未能保存新创建的问题。直到几天前该工具运行良好,所以我猜问题可能出在 Jira 服务器端。有关例外的详细信息,请参阅随附的图片。是什么导致这个异常?谢谢。

删除以下代码问题解决,奇怪。
//new_issue.Priority = "None";

我尝试了以下方法来设置优先级,但它们都触发了该异常?

var new_issue = jira.CreateIssue("THINPRO");
new_issue.Components.Add("Security");
new_issue.Type = "Bug";
new_issue.Summary = "test;
new_issue.Description = "test;

/ set priority based on CVSS score use priority id
//1 = Highest 2 = High 3 = Medium 4 = Low 5 = Lowest 6 = (not used) 7 = None
if (score <= 0.0)
new_issue.Priority = "7";
else if (score >= 7.0)
new_issue.Priority = "2" ;
else if (score <= 4.0)
new_issue.Priority = "4";
else
new_issue.Priority = "3";

new_issue.SaveChanges();

 

// set priority based on CVSS score use priority name
if (score <= 0.0)
new_issue.Priority = "None";
else if (score >= 7.0)
new_issue.Priority = "High";
else if (score <= 4.0)
new_issue.Priority = "Low";
else
new_issue.Priority = "Medium";
new_issue.SaveChanges();





Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: Response Content: 
   at Atlassian.Jira.Remote.JiraRestClient.GetValidJsonFromresponse(IRestRequest request,IRestResponse response)
   at Atlassian.Jira.Remote.JiraRestClient.<ExecuteRequestAsync>d__11.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Atlassian.Jira.Remote.JiraRestClient.<ExecuteRequestAsync>d__10`1.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Atlassian.Jira.Remote.IssuePriorityService.<GetPrioritiesAsync>d__2.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Atlassian.Jira.IssuePriority.<GetEntitiesAsync>d__2.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Atlassian.Jira.JiraNamedEntity.<LoadIdAndNameAsync>d__12.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Atlassian.Jira.Issue.<ToRemoteAsync>d__158.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Atlassian.Jira.Issue.SaveChanges()

enter image description here

enter image description here

解决方法

None 可能是无效值。

在大多数(和默认)Jira 配置中,您不能清空 Priority 字段。它是系统字段,它必须具有预定义列表中的值(通常类似于 BlockerCriticalMajorMinor em>,琐碎).