I think this answer still can help some one and save many times. I solved a similar issue by changing IQueryable
to List
(or to array, collection...).
For example:
var list=_context.table1.where(...);
to
var list=_context.table1.where(...).ToList(); //or ToArray()...