Lazy: “The function evaluation requires all threads to run”

前端 未结 5 2003
星月不相逢
星月不相逢 2020-12-05 10:46

I have a static class with some static properties. I initialized all of them in a static constructor, but then realized that it is wasteful and I should lazy-load each prope

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-05 11:24

    For me, I found it didn't matter if I had this.Configuration.LazyLoadingEnabled = false; or = true;, if I had the line in my DBContext or not. It seems to occur, from my reading up on the problem, because a thread is occurring & the debugger wants permission to run it/is warning you before it spurs it. Apparently, in some cases, you can even allow it to proceed according to MUG4N's answer here: Visual Studio during Debugging: The function evaluation requires all threads to run

    But what I found was I could get around the issue.

    2 options:

    1. Add .ToList() on your Queues:

      var q = db.Queues.OrderBy(e => e.Distributor).ToList();

    2. I found a workaround by selecting Non-Public Members > _internalQuery > ObjectQuery > Results View.

提交回复
热议问题