title: How to debug a LINQ Statement
body: <p>I have a Linq to objects statement</p>
  
  <pre><code> var confirm = from l in lines.Lines 
   where (l.LineNumber == startline.LineNumber) || (l.LineNumber == endline.LineNumber) 
   select l;
  </code></pre>
  
  <p>The confirm object is returning an 'Object Null or Not A Reference' at at System.Linq.Enumerable.WhereListIterator`1.MoveNext()</p>
  
  <p>If the result of the query was empty, it would just return an empty enumerator. I know for a fact that there are no null objects in the statement. Is it possible to step through the LINQ statement to see where it is falling over?</p>
  
  <p><strong>EDIT</strong> When I said <em>I know for a fact that there are no null objects</em> it turns out I was lying :[, but the question remains, though I am asuming the answer will be 'you can't really'</p>
  
  <p>LINQPad is a good idea, I used it to teach myself LINQ, but I may start looking at it again as a debug / slash and burn style tool</p>