无法评估前pression,因为线程停止在一个点,垃圾收集是不可能的 [英] Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible

查看:133
本文介绍了无法评估前pression,因为线程停止在一个点,垃圾收集是不可能的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是错误

无法计算EX pression,因为线程停止在一个点,垃圾收集是不可能的,可能是因为code进行了优化。

Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized.

我写了一个简单的控制台应用程序和code中的第一行是这样的:

I am writing a simple console app and the first line of code is this:

List<MyObjectModel> list = MyObjectModel.GetNonCompletedReturns();

和code的作用是:

and the code for the function is:

public static List<MyObjectModel> GetNonCompletedReturns()
{
    MyObject service = new MyObject();
    List<MyObject> entities = 
                      (from recs in service.Retrieve() where select recs).ToList();

    List<MyObjectModel> models = new List<MyObjectModel>();

    foreach (MyObject entity in entities)
    {
        models.Add(BindModel(entity));
    }

    return models;
}

如果我尝试逐步执行code,我只要一回到主我的应用程序,并悬停在该列表中,我得到了我发现的错误消息。

and if I try to step through the code, as soon as I get back to the main of my app and hover over the list, I get the error message that I showed.

谁能帮助?

推荐答案

只有当你试图调试过程中使用手表对话框这个错误的火灾。 尝试使用其他技术输出变量,如的Debug.WriteLine Console.WriteLine 等等。

This error fires only when you are trying to use Watch dialog during debug. Try to use some other technique to output the variables, like Debug.WriteLine, Console.WriteLine and so on.

这篇关于无法评估前pression,因为线程停止在一个点,垃圾收集是不可能的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆