An error occurs when retrieving a ContentType
on the following line (with cache management, from documentation):
await linkedItemsDependencyRetriever.Get(items.Select(item => item.SystemFields.ContentItemID), maxLevel: 1).ToHashSet(StringComparer.InvariantCultureIgnoreCase);
ContentType Information:
This is one of the most recently created ContentType
. A filter is applied to this ContentType
based on several criteria (pagination, date, etc.).
Error Occurrence:
The error occurs when applying the filter under specific conditions. When the result set contains either zero or more than one item, everything works as expected. However, if the result contains exactly one item, an error is thrown.
Error Message:
{"There is no data in the SqlDataRecord enumeration. To send a table-valued parameter with no rows, use a null reference for the value instead."}
Debugging Insights:
Using the debugger, it appears the error originates from the Get() method of the WebPageLinkedItemsDependencyRetriever
class. Specifically, when the error occurs, the private method GetContentItemCommonDataIds()
does not return any IDs:
IList<int> contentItemCommonDataIds = GetContentItemCommonDataIds(webPageIds); // Line 50