SequenceViz :: generate sequence diagrams from .NET assembly file

UPDATE: SequenceViz 0.2 is released. Download from the same link below to get the updated version. Read this post for what is new.

Like MethodViz, this is another attempt to understand the source code visualization. SequenceViz automatically generates the sequence diagram from the assembly. Here is a screenshot of the running application.



It uses Cecil to parse the assembly and generate the data to build the sequence diagrams. The diagrams itself are build using a component from UmlGraph (sequence.pic) and running the generated file through pic2plot from the Gnu plot utilities. Please note that this is not a replacement for the documentation and the main purpose is to better understand the exiting project.


Process Flow:


Assembly -> Cecil -> Data -> Pic file -> Pic2Plot.exe -> Sequence Diagram


Don't worry about all the different components as most of it is bundled in the application.



a) Gnu windows port for Plot utilities.

b) SVG Plugin for Internet Explorer.


How to use SequenceViz:

After installing the Gnu Plot utilities, you can download SequenceViz from the following link.


Download Source (Binaries included)


If you have downloaded the binaries or just trying to get a quick look, you can start by configuring only a single property in the LiveSequence.exe.config file.  In case you downloaded the source, this file is under the bin\Debug folder.



    <add key="Pic2PlotPath" value="C:\Program Files\GnuWin32\bin\pic2plot.exe"/>

    <add key="OutputType" value="svg"/> <!--currently only svg format is supported-->

    <add key="IgnoredMethodList" value="get_|set_|add_|remove_"/>

    <add key="IgnoredTypeList" value="System|Assert"/>

    <add key="IgnoredAssemblyList" value="mscorlib|System"/>

    <add key="IncludeAssemblyReferences" value="false"/>



Make sure you have the correct GnuPlot installation directory above. Leave the other properties for now. You can start the application by running the LiveSequence.exe file.


Now, to try an sample assembly, just click on the File menu -> Select Load Assembly. Then select CecilCase.dll which is in the same directory.



Expand CecilCase to see all the classes and subsequently expand any class to check the methods. I know it is not looking pretty without any tree icons :).



Now, you can select any method to generate the sequence diagram which will be automatically displayed in the web browser control on the right hand panel.



There are a couple of annoyances that you may find. First, you'll see a black window flashing just after you click on the method name. That is basically the console which is displayed on the command link call to pic2plot.exe application to generate the svg file. The SVG file is then rendered in the browser control.


The other issue is shown below:



By default, on clicking the method, the diagram is not centred automatically therefore you may need to drag (Alt+Mouse Move) it around to view properly. Or maximize the window.

Thats it; not bad for a useful fee tool :P .



The following tools are used in making SequenceViz.


Cecil for reading IL by Jb Evain

Excellent PHTree control from CodeProject by Peter Chen

GNU Plot utilities - Win32 Port (There is a treasure in there waiting to be utilized)

PIC File macros for Sequence Diagrams from UMLGraph by Diomidis D. Spinellis (blog)

Log4Net for logging


Thank you guys for providing these.


As always, I really appreciate if you try this and see if I can add any other features.


Update on MethodViz: MethodViz was a little experiment that I was doing. As you must have read from a comment from Jonathan, it is not trivial to find the full method hierarchy. It found myself like building a JIT compiler myself so I left it there and will not be updating that tool. I am hoping to update SequenceViz to fix any bugs and add any enhancements.

If you are looking for a professional tool with similar features, try NDepend from Patrick Smacchia.

1 Comment

Comments have been disabled for this content.