TFS webapi updates failing after updating to latest newtonsoft.json version 11

时间:2018-03-09 19:05:42

标签: tfs json.net

I'm updating Team Foundation work items using the UpdateWorkItemAsync method. The relevant line of code looks like this:

Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem result = 
workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id.Value).Result;

(I think this will loom familiar to anyone managing TFS workitems with the webapi library)

The sample code I found in github uses newtonsoft.json 9.0.0.0, and works fine. In my project I use newtonsoft.json 11.0.0.0, and the patchdocument fails to serialize (The body of the call is an empty json - {} ). And when i upgaded the sample code to version 11 it failed also.

This looks to me like a bug in version 11.0.0.0. Is there a workaround? Is there a serialization setting that i need to change? Any ideas?

1 个答案:

答案 0 :(得分:0)

我可以重现您的方案,只有版本11.0.0.0不起作用。我在下面的网站上创建了一份报告,让我们跟踪它:

https://developercommunity.visualstudio.com/content/problem/212774/api-that-update-a-work-item-field-doesnt-work-with.html

<强>更新

以下是反馈的回复:

  

看起来这是修复Newtonsoft.Json的问题   在11.0.2版本中。

你可以暂时使用newtonsoft.json 10.0.3,这是有效的。