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.

rtdm
visualizer
ilmonitor

Disclaimer: THE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES INTENDED OR IMPLIED. USE AT YOUR OWN RISK.

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

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

 

ILVisualizer.zip