Visual Studio 2010: Generating sequence diagrams on the fly

One nice feature that Visual Studio 2010 provides is generating sequence diagrams on the fly. Just point out method and choose diagram generating option from context menu. In this posting I will show you how to generate sequence diagrams on the fly.

To keep example illustrative and simple I will use simple code. Let’s suppose we have ASP.NET MVC application with following controller.


public class PriceEnquiryController : Controller

{

    // ... some properties and methods ...

 

    public ActionResult Index()

    {

        var model = new PriceEnquiryListModel();

        model.PriceEnquiries = PriceEnquiryRepository.ListPriceEnquiries();

 

        return View(model);

    }

}


Visual Studio 2010: Sequence diagram generation optionsLet’s say we want to generate sequence diagram for this method. All we have to do is to right click on method with mouse, select “Generate Sequence Diagram …” and modify some options.

You can select what kind of calls you want to include and exclude. Setting these options you can make diagram to reflect only those parts of your code that you really need to visualize.

If you look at the image you see that you can also set call depth. With more complex methods it may be very helpful because too large call depth causes huge diagram with too much knowledge on it.

When we are done with options we have to click “OK” button and Visual Studio 2010 generates sequence diagram. You can click on image to see it in original size.

Visual Studio 2010: Sequence diagram

This diagram is pretty simple and primitive but you can also generate more complex diagrams. Just set options you need and let Visual Studio 2010 generate – it works like charm. Let’s hope we get more diagrams when Visual Studio 2010 first stable version is released.


kick it on DotNetKicks.com pimp it 顶 Progg it Shout it
Shout it!

14 Comments

  • And also lets hope that we will be able to export the diagrams as images as well.

  • i can't see the row "generate seqence diagram". How does it resolve? I don't have "Architecture Explorer" in View. Help!

  • Hi, Slavo! These features come with VS2010B2. You should have Ultimate version.

  • Hi,

    How can I generate Sequence Diagram for the entire Project / Solution in Visual Studio 2010?.

    Any workaround or solution to the above query is highly appreciated.

    FYI: I am currently using VS 2010 Beta2 Ultimate Edition.

    Cheers,
    Kris

  • HOW TO EXPORT SEQUENCE DIAGRAM FORM VS2010 IN TO OTHER FORMATS?

  • Can you, please, specify what are the other formats you are interested in?

  • I would be quite interested in something like the Class Diagram "Export as image" functionality. Easy, supports PNG.

  • Thanks for feedback, randomGuy! Currently you can use my Visual Studio 2010 extension to save diagrams as images. You can find it here: http://weblogs.asp.net/gunnarpeipman/archive/2010/09/03/visual-studio-extension-save-uml-diagram-as-image.aspx

  • I have ultimate 4.0.30319 RTMRel and I don't seem to get much meet in a method sequence diagram? That is it is not showing even the first level calls though I set depth to 6.

    Really I am after a runtime sequence/timing diagram (not a design time one) that would show me (...Async) calls and events/callbacks as they occurred. Am I making sense?

    Does such thing exist in VS2010 ?
    Thank you.

  • Thanks, however VS2010 Feature Pack 2 seems for x86 only?

    It seems IntelliTrace is what I am after and VS2010 seems to be saying it's for x86.

    Should I be configuring VS2010 specifically for x86 builds in order to capture the sequence of events during a particular run? (I am running on Win7 64bit)


    Thanks

  • VS2010 is 32bit only, there is no 64bit version of VS2010 although it supports compiling 64bit binaries. IntelliTrace is available only in Ultimate version of Visual Studio 2010.

  • So the IntelliTrace panel said "IntelliTrace debugging is available only for x86 applications. To enable IntelliTrace debugging, change the platform to x86"

    If I change the build configuration for the Silverlight project along with all the other DLL projects in the solution to x86 what is the impact? Does that mean the binary generated will not take advantage of a 64bit architecture platform?

    What do you suggest doing? Switching temporarily to x86 rebuild all projects try out the IntelliTrace (I have no idea what it provides yet) see if it uncovers any issues than return to standard "Release" build configuration for deployment?

    Thank you.
    PS. If you know a good link about managing and using build configurations please point me out. I certainly need a refresh in this area :)

  • I forgot to mention that the "Release" configuration is set to Platform = "Any CPU" for all projects referenced directly in the solution or for the external ones (DLL references)
    Should I switch to Platform = "x86" for the solution referenced projects or everything in order to experiment with how IntelliTrace will help me uncover some of the bugs.
    Thanks again.


  • Did people find where this Generating Sequence Diagram menu item is? I am running VS 2010 Ultimate. I don't see this function either.

    Any advice is greatly appreciated.


    Min

Comments have been disabled for this content.