title: Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible
body: <p>Here is the error </p>
  
  <blockquote>
    <p>Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized.</p>
  </blockquote>
  
  <p>I am writing a simple console app and the first line of code is this:</p>
  
  <pre><code>List&lt;MyObjectModel&gt; list = MyObjectModel.GetNonCompletedReturns();
  </code></pre>
  
  <p>and the code for the function is:</p>
  
  <pre><code>public static List&lt;MyObjectModel&gt; GetNonCompletedReturns()
  {
      MyObject service = new MyObject();
      List&lt;MyObject&gt; entities = 
                        (from recs in service.Retrieve() where select recs).ToList();
  
      List&lt;MyObjectModel&gt; models = new List&lt;MyObjectModel&gt;();
  
      foreach (MyObject entity in entities)
      {
          models.Add(BindModel(entity));
      }
  
      return models;
  }
  </code></pre>
  
  <p>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. </p>
  
  <p>Can anyone help?</p>