'Unable to set AreaPath of a new bug in Azure Devops

When I programmatically create a new bug and set the area path to this:

VssBasicCredential credentials = new VssBasicCredential(string.Empty, personalAccessToken);
new JsonPatchOperation()
{
   Operation = Operation.Add,
   Path = "/fields/System.AreaPath",
   Value = "Project"
},

WorkItem bug = await workItemTrackingHttpClient.CreateWorkItemAsync(patchDocument, project, "Bug").ConfigureAwait(false);

I get this error:

TF401346: Invalid Area/Iteration id given for work item -1, field 'System.AreaId'.

I think this is a bug, this area path exists in ADO.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source