While using Stored Procedure with Entity Framework if you get below error Message:
Image 1.
It simply means: Try explicitly enumerating the results by calling ToList().
Replace Your Code From
foreach (var item in query)
To #:
foreach (var item in query.ToList())