---
title: "Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase"
url: "https://osherove.com/blog/2007/11/2/debugger-visualizers-for-methodinfo-dynamicmethod-and-method.md"
canonical: "https://osherove.com/blog/2007/11/2/debugger-visualizers-for-methodinfo-dynamicmethod-and-method.html"
published: "2007-11-02T18:32:44"
updated: "2007-11-02T18:32:44"
tags: []
author: "Roy Osherove"
description: "Oren's post about DynamicMethods in Reflection is a great \"advanced\" intro to the idea of DyamicMethod (a method you can create on the fly and then cache to execute many times - great of optimization scenarios over…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase

By Roy Osherove November 2, 2007

**Historical article** · Originally published November 2, 2007; technical details may be outdated.

[Oren's post](http://www.ayende.com/Blog/archive/2007/10/29/Dynamic-Methods.aspx) about [DynamicMethods](http://msdn2.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx) in Reflection is a great "advanced" intro to the idea of DyamicMethod (a method you can create on the fly and then cache to execute many times - great of optimization scenarios over multiple objects).

My last talk at TechEd Europe this year will be about "Deep Reflection". It is a variant of a session I did at TechEd Israel and one of the topics I cover there is the use of DyanmicMethods.

One of the things that I also show there is how you may be able to create a DyamicMethod and MethodInfo Visualizer, that shows you the IL produced in the method as you create it. Very powerful if you want to debug code generated at runtime.

Here's a screenshot of the visualizer at work over a MethodInfo object. It will work just as well on a DynamicMethod object:

You can download the visualizers for these here:

- [DynamicMethod and MethodInfo visualizers](http://teamagile.com/Downloads/DmVis.zip) (VS 2005 and VS 2008 bin versions)
- [The original post](http://weblogs.asp.net/rosherove/archive/2006/04/25/MethodsVisualizer.aspx) that also has links to the source code

\* possible cool thing you can do: Use [RunSharp](http://www.codeproject.com/dotnet/runsharp.asp) when generating the IL inside a DynamicMethod. I'm not sure it's possible but I'll check and maybe present this.


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
