Roy Osherove

View Original

Debugger Visualizer for MethodInfo, DynamicMethod, and MethodBase available for download

When I was preparing (still am) for my TechEd talk about Reflection 2.0, one of the coolest things I found was this nice DynamicMethod visualizer posted as a code sample.
 
Taking apart the code for this project was a blast, and I learned many interesting things. I set out to create a new version of this Debugger Visualizer that also supports visualizing MethodInfo objects, not just Dynamic Methods (Code generated on the fly).
 
Here's the result:
 
Sample shots:
 
Visualizing a MethodInfo object:
 
 
 
 
 
Visualizing a DynamicMethod object (the original ability for the code):
 
 
 
The source can help you learn how to:
  • Get the IL byte stream from any MethodBase-based object
  • Parse IL into understandable chunks
  • Write a visualizer
  • Resolve strings, methods and types from static Tokens in the IL code (see StaticResolver class)
  • Understand IL Opcodes and what they stand for
Have fun, geeks!