Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase - ISerializable - Roy Osherove's Blog

Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase

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 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:

image

You can download the visualizers for these here:

 

* possible cool thing you can do: Use RunSharp when generating the IL inside a DynamicMethod. I'm not sure it's possible but I'll check and maybe present this.

Published Friday, November 02, 2007 8:32 PM by RoyOsherove

Comments

Saturday, November 03, 2007 1:04 AM by Stefan Simek (RunSharp)

# re: Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase

Hi All,

Generating DynamicMethod-s is not possible because of my omission in the 0.1 release of RunSharp - I'm planning to release a 0.1.1 patch soon (hopefully this weekend, or the next week), that will include support for DynamicMethods.

Regards,

Stefan

Saturday, November 03, 2007 3:47 AM by RoyOsherove

# re: Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase

Stefan: If you can release that support in the next 3 days I may be able to put that in my presentation as a cool demo!

Monday, November 05, 2007 2:09 PM by Garo Yeriazarian

# re: Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase

What if you could tie into Reflector and generate a nice C#/VB.NET/Boo decompile of the IL in the Dynamic Method?

Monday, November 05, 2007 4:34 PM by Console.Write(this.Opinion)

# Resumo da semana - 05/11/07

Resumo da semana - 05/11/07

Monday, November 05, 2007 11:15 PM by Stefan Simek (runsharp)

# re: Debugger Visualizers for MethodInfo, DynamicMethod, and MethodBase

Hi Roy,

You can find the 0.1.1 release with DynamicMethod (see the DynamicMethodGen class) support at SF.net (www.sf.net/.../runsharp). I'll update the codeproject download in a while.

Regards,

Stefan

Thursday, November 29, 2007 4:07 AM by ISerializable - Roy Osherove's Blog

# IL Debug Visualizer for Compiled Lambda Expressions, MethodBase and DynamicMethod

Mark Watts just emailed me with cool news. He took the Dynamic Method visualizers I worked on and created