public bool MoveNext() { try { using (CosmosQueryContext.ConcurrencyDetector.EnterCriticalSection()) { if (!_hasExecuted) { if (!TryGetResourceId(out var resourceId)) { throw new InvalidOperationException(CosmosStrings.ResourceIdMissing); } if (!TryGetPartitionId(out var partitionKey)) { throw new InvalidOperationException(CosmosStrings.ParitionKeyMissing); } _item = CosmosClient.ExecuteReadItem( ContainerId, partitionKey, resourceId); var hasNext = !(_item is null); Current = hasNext ? Shaper(CosmosQueryContext, _item) : default; _hasExecuted = true; return(hasNext); } return(false); } } catch (Exception exception) { Logger.QueryIterationFailed(ContextType, exception); throw; } }