FeedIterator<T>.ReadNextAsync throws NullReferenceException with custom serializer
See original GitHub issueDescribe 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:
- Created 4 years ago
- Comments:16 (16 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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