Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enumerating IEnumerable in EF6 in debugger issues "Children could not be evaluated" error

I have a new ASP.NET MVC 5 project and am attempting to query a code first database through a IdentityDbContext.

If I query a particular DbSet and insert a breakpoint, attempting to read the contents of the IEnumerable will result in VS 2013 telling me that the children could not be evaluated.

I did not have this issue in EF5 / MVC 4.

Has something changed as to make evaluating IQueryables and the like impossible in the debugger in EF6?

Thanks

like image 776
Sergio Avatar asked Oct 28 '13 10:10

Sergio


1 Answers

This is how it works for now, hopefully it will get fixed at some point, but for now you have to "ToList()" stuff via the watch windows. Urgh!

EF Team Triage: The root cause behind this is an external issue with Lazy. We did discuss creating our own re-implementation of Lazy to workaround the issue but at this stage it doesn't seem to justify the effort. If we see more complaints about this in the future we will reconsider.

> The best workaround is to add a ToList() or similar (either in the code or as a Watch) to see the results.

http://entityframework.codeplex.com/workitem/1898

like image 85
4imble Avatar answered Oct 31 '22 17:10

4imble