When we try to load TrustProduct Channel Endpoint Assignments with limit 1000 it only fully loads 67 records out of 130. If we do a foreach through it - it results in an inconsistent behavior where we cannot rely on the data properties.
We have to resort in doing "ToList()" on the result set to get all the entities fully loaded.
Code Snippet
var incomingPhoneNumbers = await IncomingPhoneNumberResource.ReadAsync(limit: 1000, client: twilioRestClient);
var trustProductAssignments = await TrustProductsChannelEndpointAssignmentResource.ReadAsync(
new ReadTrustProductsChannelEndpointAssignmentOptions(shakenStirTrustProductSid)
{
Limit = 1000
}, twilioRestClient);
foreach (var number in incomingPhoneNumbers)
{
if (trusthubAssignments != null && trusthubAssignments.Select(n => n.ChannelEndpointSid).Contains(number.Sid))
{
continue; // this will not execute correctly because trusthubAssignments entity is not loaded fully
}
}
// IF we do this the entities get fully loaded and we don't have the issue - note that this issue is only with TrustProductsChannelEndpointAssignmentResource:
var trustProductAssignments = (await TrustProductsChannelEndpointAssignmentResource.ReadAsync(
new ReadTrustProductsChannelEndpointAssignmentOptions(shakenStirTrustProductSid)
{
Limit = 1000
}, twilioRestClient)).ToList();
Issue Summary
When we try to load TrustProduct Channel Endpoint Assignments with limit 1000 it only fully loads 67 records out of 130. If we do a foreach through it - it results in an inconsistent behavior where we cannot rely on the data properties.
We have to resort in doing "ToList()" on the result set to get all the entities fully loaded.
Code Snippet
Technical details:
csharp version: C# 12