My guess is that your resourceItems
variable is still a LINQ enumerable which is referenced from the _cacheManager.Get
lambda. When that lambda actually gets executed, I suspect that the objects it refers to have already been disposed. I would recommend executing the enumerable before referencing it in the lambda. Something like:
var finalResourceItems = resourceItems.ToList();
return _cacheManager.Get(cacheKey, ctx =>
{
ctx.Monitor(_clock.When(TimeSpan.FromMinutes(CacheTime)));
return finalResourceItems;
});