twilio-csharp icon indicating copy to clipboard operation
twilio-csharp copied to clipboard

Can Not Enumerate Twice Over a ResourceSet That Has Pages

Open joelweiss opened this issue 3 years ago • 1 comments

Issue Summary

Once you enumerate over a ResourceSet<T> that has pages, on subsequent enumerations you only get back the last page

Code Snippet

var messageResource = await MessageResource.ReadAsync(readMessageOptions, client).ConfigureAwait(false);
Console.WriteLine($"Found {messageResource.Count()} Messages");
Console.WriteLine($"Found {messageResource.Count()} Messages");

Outputs

Found 236 Messages
Found 36 Messages

Problem code is in ResourceSet.cs where FetchNextPage() overrides the prior page's _iterator and doesn't keep track of it.

joelweiss avatar Aug 06 '21 17:08 joelweiss

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

shwetha-manvinkurke avatar Aug 06 '21 22:08 shwetha-manvinkurke