Sep 22 2011

Visual Studio 2010 Expression Tree Debugger Visualizer: how to make it work.

Category: C# | Visual Studio — Duke @ 19:21

I’m developing a quite complicated (it is always complicated when you have to manage big trees) project.

As in the project there are a lot of trees that are moving around (never seen a tree walking down the streets?)  and transforming themselves I’ve thought that it could be nice to use a Debug Visualizer to have a clearer view of the structure of these expression trees.

I know, the visual studio 2010 have the new DebugView property that makes it inspect the tree.. but it is still complicated to read when you have kilometric long namespace names that ends in generic object that in turn uses generic parameters with (again) long names.

it is a mess Triste

so I’ve decided to use the old but still good Expression tree visualizer available from the Visual studio 2008 C# code samples.

Downloaded, changed the reference to the Microsoft.VisualStudio.DebuggerVisualizers.dll library so to reference the newest one (C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.VisualStudio.DebuggerVisualizers.dll) and then compiled.

But here starts the problem:

My configuration is Windows 7 64 bit Ultimate and Visual studio 2010 Ultimate (with latest service packs and everything)

My projects are all in .Net 4.0 at the moment I'm writing.

I’ve compiled the visualizer, put it in the right folder

C:\Users\Duke\Documents\Visual Studio 2010\Visualizers

and BAM! …. nothing Triste

nothing appear, no magnifier  when I hover an expression reference.

I’ve tried to moving the visualizer in all the possible valid location (also considering the 64 bit architecture) but noting!

Binged and Googled… I’ve found that many people have had the same issue.

So I’ve started looking inside the actual code, and here it is!


[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizer), typeof(ExpressionTreeVisualizerObjectSource), Target = typeof(Expression), Description = "Expression Tree Visualizer")]

Sooooo wrong! I’ve fixed it this way


[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizer), typeof(ExpressionTreeVisualizerObjectSource), Target = typeof(Expression<>), Description = "Expression Tree Visualizer")]

Note typeof(Expression) transformed in typeof(Expression<>)

The type to visualize should be the generic one to work with the last version of the framework.

Recompiled, dropped in the right folder and this time IT WORKS!

Ok! now it works like a charm I hope this could help also other people with the same issue Sorriso


Hermine Hermine says:

Hey! I understand this is somewhat off-topic but I needed to ask. Does building a well-established blog like yours require a massive amount work? I'm completely new to writing a blog but I do write in my journal every day. I'd like to start a blog so I will be able to share my personal experience and feelings online. Please let me know if you have any recommendations or tips for brand new aspiring bloggers. Appreciate it!

Take a look at my blog post :: behandling for prostatit -  Hermine -  -

2. says:

Howdy just wanted to give you a quick heads up. The text in your post seem to be running off the screen in Safari. I'm not sure if this is a formatting issue or something to do with browser compatibility but I figured I'd post to let you know. The design and style look great though! Hope you get the problem resolved soon. Cheers

Feel free to visit my site - Raucherentwohnung Richtlinien ( - )

3. says:

Yes! Finally someone writes about the casino.

Here is my website ... Alkoholabhangigkeit Diagnosekriterien ( - )

tirage de tarot gratuit tirage de tarot gratuit says:

Astrologie noire capricorne voyeur  tirage gratuit tarot

Visit my site ...  tirage de tarot gratuit -

Add comment

  Country flag

  • Comment
  • Preview