question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FeedIterator<T>.ReadNextAsync throws NullReferenceException with custom serializer

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
ealsurcommented, Nov 20, 2019

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

1reaction
fuocorcommented, Oct 2, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cosmos DB ReadNextAsync throwing JSON Serialization ...
I have checked that none of the records have id = 1. Full stack trace at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.AddReference ...
Read more >
NullReferenceException Class (System)
The exception that is thrown when there is an attempt to dereference a null object reference.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found