gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 04:05:04 24 4
gpt4 key购买 nike

我尝试通过以下代码通过 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com