title: Debugging .NET dynamic methods
body: <p>We are using LINQ very widely in our system. Particularly LINQ-to-objects. So in some places we end up having a LINQ query in memory build up from some huge expressions. The problem comes when there's some bug in the expressions. So we get NullReferenceException and the stack trace leads us nowhere (to [Lightweight Function]). The exception was thrown inside the dynamic method generated by LINQ.</p>
  
  <p>Is there any easy way to debug such dynamic methods? Or do I have to sacrifice myself to learning WinDBG? :-)</p>