.net - 发布没有必填字段值的新缺陷时,Rally Rest .NET API 抛出 KeyNotFoundException

标签 .net rest rally

我尝试通过以下代码通过 Rest .net api 向 Rally 发布新缺陷:

var api = new RallyRestApi("<myusername>", "<mypassword>", "https://community.rallydev.com");

var defect = new DynamicJsonObject();
defect["Name"] = "Sample Defect";
defect["Description"] = "Test posting defect without required field value";
defect["Project"] = "https://trial.rallydev.com/slm/webservice/1.29/project/5808130051.js";
defect["SubmittedBy"] = "https://trial.rallydev.com/slm/webservice/1.29/user/5797741589.js";
defect["ScheduleState"] = "In-Progress";
defect["State"] = "Open";

CreateResult creationResult = api.Create("defect", defect);

但是 api 抛出了一个奇怪的异常:
System.Collections.Generic.KeyNotFoundException was unhandled 
   Message=The given key was not present in the dictionary.
   Source=mscorlib
   StackTrace:
      at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
      at Rally.RestApi.DynamicJsonObject.GetMember(String name)
      at Rally.RestApi.DynamicJsonObject.TryGetMember(GetMemberBinder binder, Object& result)
      at CallSite.Target(Closure , CallSite , Object )
      at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
      at Rally.RestApi.RallyRestApi.Create(String type, DynamicJsonObject obj)
      at RallyIntegrationSample.Program.Main(String[] args) in D:\Projects\qTrace\References\Samples\RallyIntegrationSample\Program.cs:line 24

问题是当我查看 Rally 的跟踪日志文件时,它显示了发布请求中的错误:
Rally.RestApi Post Response:
{
   "CreateResult":
   {
       "_rallyAPIMajor":"1",
       "_rallyAPIMinor":"29",
       "Errors":["Validation error: Defect.Severity should not be null"],
       "Warnings":[]
   }
 }

Rally Rest .Net Api 没有在其属性中提供具有相应错误信息的正确 CreateResult 对象,而是抛出意外异常。

这是 Rally rest .net api 中的一个错误,还是我应该执行任何额外的步骤来无缝获取 CreatResult,以防 Rally 服务返回任何错误?

非常感谢您的帮助。

最佳答案

这听起来像是一个缺陷。下周左右将有一个库的维护版本来修复另一个缺陷 - 我会尝试重现这个并将发布我的发现。

关于.net - 发布没有必填字段值的新缺陷时,Rally Rest .NET API 抛出 KeyNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9992281/

相关文章:

SDK 2.0 - 架构需要非常长的时间来加载

.net - 将键码转换为相关的显示字符

c# - 如何获取表单的截图

c# - 在派生类的构造函数中添加事件处理程序或覆盖 OnX() 方法?

javascript - 处理 Rally 数据存储中的空异常

javascript - 在集会 : Can I map custom task states to existing Task states in a Rally Task Board (similar to Kanban for user stories)?

c# - 具有相同方法名称的多级继承c#

javascript - 如何列出 Express 安装的应用程序的所有 REST 端点?

c# - Web Api 如何定义具有相同参数的 2 个方法

java - 如何在没有 web.xml 的情况下应用 ContainerRequestFilter?