Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Roslyn Syntax Visualizer Extension work?

When Roslyn installed, it comes with a couple of great demo tools. Firstly, the most valuable I think for those who want to learn syntax trees more thoroughly is the Syntax Visualizer Tool Window which shows the syntax tree of active *.cs files.

Everything worked fine when I launched this extension and tried it in a test instance of Visual Studio. But when I have installed this extension, it's not working anymore. I still have View -> Other Windows -> Roslyn Syntax Visualizer but just an empty window tool pops up.

Does anyone have the same problem and know the solution?

I guess that maybe I need to copy DLL files which this extension produces when rebuild but I don't know where should I put it.

Later I found another interesting detail - when I launch my own extension, Syntax Visualizer Tool works! So, it works only in test instance of Visual Studio. Why it should be like that?

like image 539
Vitalii Korsakov Avatar asked Feb 19 '12 21:02

Vitalii Korsakov


2 Answers

The Syntax Visualizer only works when you are running Visual Studio with Roslyn enabled. When you start a test instance of Visual Studio, Roslyn is automatically enabled. Manually starting Visual Studio with Roslyn can be done by adding /rootsuffix Roslyn to the shortcut, but take care that Roslyn is not finished yet. It might not be advisable to enable it by default, depending on what you are working on. Of course, you can also just create another shortcut with Roslyn, so you can choose which one you want.

If you see [Roslyn] in your code tabs in Visual Studio, then you can use the visualizer. Another way of verifying if Roslyn is enabled is to view your extensions. The Roslyn Language Services has to be there for it to work. If this is not the case, then the visualizer can be opened, but it won't show any contents.

You can find more information about the visualizer extension here.

like image 75
Nico vD Avatar answered Sep 24 '22 00:09

Nico vD


Nico most likely has the answer. Look in the Debug properties of the Syntax Visualizer project to see that it is launching with /rootsuffix Roslyn. Also, without launching this way, you should be able to see the Syntax Visualizer in the C# REPL and C# Script editor windows; as these are Roslyn CSharp editors.

like image 40
Jeff Griffin Avatar answered Sep 26 '22 00:09

Jeff Griffin