Take Two: IL Visualizer

I was glad to hear many positive feedbacks about the DebuggerVisualizer for DynamicMethod; on the sad side, it shows our lack of good LCG debugging support (on which, Mike Stall is seeking your opinion).

Recently along with the ILReader update, I made a few changes on the visualizer:

  • Add support to show IL of RuntimeMethodInfo and RuntimeConstructorInfo (besides DynamicMethod). Actually Roy already had a version providing such functionality. Last year, I wanted to enable viewing IL on all MethodBase-derived types. Well, my daily duty and interests changed; I am afraid I won’t ever meet that goal.

  • Add support to show IL of Delegate.MethodInfo, where the delegate might be created from DynamicMethod.

  • Simplify IL Visualizer UI. When the DynamicMethod IL code is incomplete, those branch instructions’ label shown inside the visualizer could be incorrect. However it is easy to identify this fixup failure: they always branch to the next instruction. I removed the label-fix-succeed-failed information as well as the font ComboBox at the bottom of the dialog. Now changing the font is done by the RichTextBox’s context menu.

  • Add another way to view IL: “Send to IL Monitor”. DebuggerVisualizer dialog is a modal dialog, which means we have to dismiss it first to continue anything with Visual Studio. I found this is inconvenient when trying to track the whole code-gen process. You can now choose “Send to IL Monitor”. Before clicking it, a separate application “ilmonitor.exe” need to be started first. Those IL information is sent to this application with TCP socket (and the listening port number is hard-coded as 22017). For one dynamic method, if we click the magnifying glass “Send to IL Monitor” button a couple of times at different code-gen stages, the same window will show the growing IL with different background colors. As you see from the pictures below, it can also track many dynamic methods’ IL.

You may download the attachment and try to build the solutions in your VS. The images below were captured in my Vista box.



update (3/7/2008): VS2008 solution can be found at http://blogs.msdn.com/haibo_luo/archive/2008/03/07/8107924.aspx.

update (4/19/2010): VS2010 solution can be found at http://blogs.msdn.com/haibo_luo/archive/2010/04/19/9998595.aspx 



Comments (6)

  1. Joel Pobar says:

    Very cool!

    What are you doing these days?

  2. Fabio says:

    Well… the tool is easy to get.

    It would be really nice to have also a *little* "how to".

    I read all your blogs on this but I still wonder how I can use it in VS.

    The IL Monitor show an empty form that is "monitoring" no-one-know-what… 🙁

  3. Very convenient. Thanks!

    Here’s a little "how to":

    -download ILVisualizer.zip and uncompress it

    -build the solution in VS or using msbuild

    -copy the resulting 3 dlls to your local "Visualizers" directory for VS.Net to find them, as documented at http://msdn2.microsoft.com/en-us/library/sb2yca43(VS.80).aspx

    -restart VS.Net

    -debug a piece of code involving a DynamicMethod

    -watch the DynamicMethod and click the little   magnifier icon. More details at http://msdn2.microsoft.com/en-us/library/xdakzs26(VS.80).aspx

  4. Yuanjian says:

    .NET: Gathering code coverage information from the command line Graphics Debugger Visualizer IL Visualizer

  5. gOODiDEA says:


  6. IL Visualization DebuggerVisualizer for DynamicMethod Take Two: IL Visualizer The Marvels of Monads Generics in C#, Java, and C++ AmazNode] You give it a topic and it searches Amazon, displaying a network of related items. .NET BackgroundWorker class..