azure-cosmos-dotnet-v3: FeedIterator.ReadNextAsync throws NullReferenceException with custom serializer

Describe the bug FeedIterator<T>.ReadNextAsync throws NullReferenceException with custom serializer. The stream sent to the serializer is empty. `All the other Cosmos methos serialize fine and GetItemQueryStreamIterator works as does the default serializer.

To Reproduce

var families = new List<Family>();

var setIterator = container.GetItemQueryIterator<Family>(requestOptions: new QueryRequestOptions { MaxItemCount = 1 });
while (setIterator.HasMoreResults)
{
    foreach (var item in await setIterator.ReadNextAsync())
    {
        families.Add(item);
    }
}

Expected behavior Deserialized object.

Actual behavior NullReferenceException

Environment summary SDK Version: 3.0.100 Cosmos Version: 3.2.0 OS Version: Windows 10

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Yes, it fixes using a custom serializer with Change Feed, as it will only used for the Delegate changes.

I tracked it down, The FeedIterator wraps the result inside a response with a “Documents” element. The default serializer seems to address it whereas a custom serializer needs to drill into the response