title: Expression cannot contain lambda expressions
body: <p>I have fetched the <code>List&lt;&gt;</code> object as below (with <code>.Include()</code>):</p>
  
  <pre><code>List&lt;vDetail&gt; entityvDetails =
      context.vDetails
      .Include("payInstallment.appsDetail")
      .Include("payInstallment.appsDetail.application")
      .Include("payInstallment.appsDetail.purposes")
      .Where(e =&gt; e.vch_id == 123).ToList();
  </code></pre>
  
  <p>And then somewhere in the code ahead I tried to filter the entity record as below:</p>
  
  <pre><code>foreach (vDetail item in lstVDetails)
  {
      ... 
  
      int purposeId = entityvDetails.Where(e =&gt; e.sad_id == item.sad_id).FirstOrDefault().payInstallment.appsDetail.purposes.prp_id;
  
      ...
  }
  </code></pre>
  
  <p>Code compiling perfect. However, the runtime returning following error (although all navigations are included):  </p>
  
  <pre><code>Object reference not set to an instance of an object.
  </code></pre>
  
  <p>So I set for debugging using the watch window. Now while analyzing the below statement in watch window:</p>
  
  <pre><code>entityVoucherDetails.Where(e =&gt; e.sad_id == item.sad_id).FirstOrDefault()
  </code></pre>
  
  <p>the watch window generated following error:</p>
  
  <blockquote>
    <p>Expression cannot contain lambda expressions.</p>
  </blockquote>
  
  <p>Please if anybody can tell me what could be the reason?</p>