title: What is a PartialEvaluationExceptionExpression and how do I fix it?
body: <p>I have some code with LINQ query using nHibernate and when it executes, it throws a PartialEvaluationExceptionExpression. What exactly does this mean, and what can I do about it?</p>
  
  <pre><code>SomeIqueryableNhibernateObject
  .Where(x=&gt;...
  some expression
  &amp;&amp; !Model.date.HasValue ? true : (x.fooDate.Date == Model.date.Value.Date)
  &amp;&amp; some expresion
  </code></pre>
  
  <p>Where Model is:</p>
  
  <pre><code>public class Filter
  {
     DateTime? date;
  }
  </code></pre>
  
  <p>Exception is caused by the false path of the ternary operator:</p>
  
  <pre><code>x.fooDate.Date == Model.date.Value.Date
  </code></pre>
  
  <p>Even if I modify it to:</p>
  
  <pre><code>x.fooDate != null &amp;&amp; Model.date.HasValue &amp;&amp; x.fooDate.Date == Model.date.Value.Date
  </code></pre>
  
  <p>it still throws the exception.</p>