Visual Studio during Debugging: The function evaluation requires all threads to run

后端 未结 5 2003
轻奢々
轻奢々 2020-12-01 13:54

I\'m getting suddenly a strange error while debugging. Up to now the variable in the watch windows has been shown correctly. Now I am getting always the error message in the

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 14:07

    I ran into this issue when just trying to get items from a table called "AGENCY" using Entity Framework:

    var agencies = db.AGENCY.OrderBy(e => e.FULLNAME);
    

    Hovering over agencies in debug mode, clicking to expand the options, and clicking Results would give the dreaded "The function evaluation requires all threads to run" with a "Do Not Enter" icon at the end that, on which, clicking did nothing.

    2 possible solutions:

    1. Add .ToList() at the end:

      var agencies = db.AGENCY_TABLE.OrderBy(e => e.FULLNAME).ToList();

      List agencies = db.AGENCY_TABLE.OrderBy(e => e.FULLNAME).ToList();

      Credit goes to Hp93 for helping me come to this solution. In the comments on MUG4N's answer where I found this solution, it also mentions trying .Any() instead of .ToList(), but this gives a Boolean instead of a , like is, so it probably wouldn't help.

    2. Workaround - try a different path in the debug options. I found that I could click on the "Non-Public Members" > "_internalQuery" > ObjectQuery > Results View and get my values that way.

提交回复
热议问题