title: How to get a dump of all local variables?
body: <p>How can I get a dump of all local &amp; session variables when an exception occurs? I was thinking of writing some sort of reflection based function that would interrogate the calling function &amp; create a dump of variables &amp; values.</p>
  
  <p>Is there an existing library that I can use?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After speaking to a colleague, I was pointed to AOP or Aspect Oriented Programming.  Here is what I understand ... Using AOP, one would simple decorate the methods &amp; classes with certain attributes. AOP framework then injects code in or around these classes &amp; methods.  There are two separate kinds of framework, one that injects code &amp; then compiles the assembly &amp; the second simply uses reflection &amp; traps the call which you have decorated and wraps whatever code around the method at runtime.</p>
  
  <p>I hope all that makes sense.  I will be doing more research on this &amp; post my approach.</p>
  
  <p>Thanks guys ...</p>