AutoDiagrammer : My Reflector Addin, C#, WPF

200% Reflective Class Diagram Creation Tool

Some of you may have been members for quite some time, and may recall about 4 years ago I published a article which drew a class diagram from a Dll/exec called "AutoDiagrammer" I was quite lucky with that article, as it turned out to be very popular, and got loads of votes and a tonne of views, basically people seemed to love it, which is ace…I was very happy with that. Every author here wants people to like the stuff they publish (myself included, its the whole vanity thing I suppose).

Thing is, I wrote that orginal article a long time ago, when I was just getting into WPF, and although I was pretty happy with it, I always thought it could be so much better. So fast forward a couple of years, I now know enough WPF to really do justice to the orginal article and get it how I always envisaged it could be.

The things that I felt were wrong with the 1st  "AutoDiagrammer" article were as follows:

  1. The drawing of class associations was based on a grid layout
  2. The user could not move the classes around on the design surface, once they were laid out that was it
  3. The Association lines were not that clear to see
  4. The user could not scale the produced diagram that well (it was possible, but was not that great)
  5. The loading of the Dll/Exe to be drawn as a class diagram was done in the same AppDomain as the AutoDiagrammer.exe app, so when reflecting would be forced into loading ALL the additionally reflected types from the Dll/Exe into the AutoDiagrammer.exe apps AppDomain. Ouch…Not cool
  6. People found is slightly cumbersome figuring out how to get a diagram actually produced

That said, there were things I feel I definately got right such as

  1. The overall idea (people seemed to generally like it, and find it a very useful tool)
  2. The reflecting of information was correct
  3. The ability to fine tune what was show on the diagram

With all these good and bad points in mind coupled with the fact that I now know enough WPF to do the original code justice and do it how I always wanted to do it, I thought..YES the time is right, do a complete re-write of the original article.

So that is what this article is, it is a complete re-write of the original  "AutoDiagrammer" article, the feature list of this new articles code is:

  1. Detection of valid .NET assembly (Yes same as the 1st article, this tool only works with .NET Assemblies)
  2. The ability to move the classes in the design surface within the diagram
  3. The ability to not show classes that did not have any associations on the diagram, but still allow the user the ability to view these from a drop down list. This aids in keeping the diagram clutter free, only show what is absolutely needed
  4. Persisted settings, so that the next time the application is run, your personal settings will be as you left them
  5. Proper scaling of objects as vectors, so whatever scale the diagram is viewed at the objects are as clear as they could be
  6. Saving of the diagram to a XPS (Extensible Paper Standard) document which can easily be viewed using the standard Window XPS Viewer
  7. Printing a XPS document to a printer
  8. Loading the Dll/Exe into a seperate AppDomain that does not poluate the AutoDiagrammer.exe AppDomainwith the loaded Dll/Exe types
  9. Integrated help
  10. The classes show a full Association popup with all Associations shown a list of strings
  11. The Association lines show in a different color when the user hovers over them with the mouse
  12. Better detection of Associations between classes via parsing of method body IL (Intermediate Language)
  13. The ability to view method body IL (Intermediate Language)

As you can see I have kept what was good with the old article/codebase and have added more features to it. I am really happy with how it turned out and I hope you will be to.


if you want to know more you can read the full article over at this link:

And here is a small screen shot of the new codebase in action:


AutoDiagrammer : My Reflector Addin, Current Work, Significant Projects (Shareable)

AutoDiagrammer : My Reflector Addin

At the beginning of March 2007, i published an article at codeproject about drawing a class diagram using reflection. This article is available here.

The thing being, as more and more people looked at it, they all wanted it to be available as an addin for Lutz Roeder C# De-Compiler which is free and available here.

So finally I gave in, and had a go at getting it to work as a reflector addin, I think i’ve now got there with v1.9 of AutoDiagrammer, which is available right now at the AutoDiagrammer auto update link.


Ive also kept most of the stand alone application features such as :

  • Zoomable window
  • Printing
  • Customization of what is shown on the diagram
  • Save to image


I have also now included any associations as a Tooltip, so when there are a lot of classes with a lot of lines going everywhere, simply point the mouse at a class, and see what it tells you.


I’m just waiting for the codeproject staff to update the article, and then ill be giving Lutz the Addin for official release at his CodePlex site. And then im sure there will be pleny of folk that will have some more suggestions….