1

I am doing some long-winded code generation at run-time using expression trees. But once I've done the Expression.Lambda<Foo>(methodBody, objArg).Compile() everything is turned into a black box. I am wondering, what is the best approach and tools to

  1. Debug in case something fails? I haven't found a way to step-debug my code
  2. Get an overview of the generated IL
3
  • 2
    For point 2. you can use the ILDasm tool from Microsoft. A code-aproach is described in this SO answer. Commented Mar 23, 2014 at 15:54
  • 1
    ...and maybe Cecil.Mono - AFAIK LINQPad is using it and my guess is for the disassembly of the code. Also this MSDN article: Debugging Expression trees - in VS2010 there was an example expression tree visualizer and in VS2012 the tool is build-in. Commented Mar 23, 2014 at 16:04
  • 1
    This answer suggests adding your lambda to a dynamic assembly, which you then dump to a dll and view with a disassembler. Also, you can use the IL Visualiser from MSDN for a live (debug) IL view. Commented Apr 8, 2014 at 6:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.