private async Task <IEnumerable <Wit> > InternalGetWitsByIdChunked(List <int> ids, string[] fields, DateTime?asOf, WorkItemExpand?expand, WorkItemErrorPolicy?errorPolicy, CancellationToken cancellationToken) { const int nSize = 150; var workItems = new List <Wit>(); if (errorPolicy == null) { errorPolicy = ErrorPolicy; } // Chunk the retrieval. for (int i = 0; i < ids.Count; i += nSize) { var range = ids.GetRange(i, Math.Min(nSize, ids.Count - i)); using var mc = log?.Enter(LogLevel.RawApis, new object[] { range, fields, asOf, expand, errorPolicy, null, cancellationToken }, "GetWorkItemsAsync"); { var results = await WorkItemClient.GetWorkItemsAsync(range, fields, asOf, expand, errorPolicy, userState : null, cancellationToken) .ConfigureAwait(false); workItems.AddRange(results); } } return(workItems); }