Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
DZone MVB

Links

Social

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!

Comments

Kjell-Åke Andersson said:

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

# November 22, 2009 6:19 AM

slavo said:

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

# January 10, 2010 1:30 PM

DigiMortal said:

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

# January 10, 2010 8:22 PM

Kris said:

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

# January 15, 2010 10:34 PM

UT said:

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

# September 20, 2010 11:16 PM

DigiMortal said:

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

# September 21, 2010 4:11 AM

randomGuy said:

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

# October 5, 2010 11:41 AM

DigiMortal said:

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

# October 6, 2010 5:41 PM

marie123 said:

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.

# February 27, 2011 6:12 AM

marie123 said:

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

# March 9, 2011 4:15 AM

DigiMortal said:

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.

# March 9, 2011 2:38 PM

marie123 said:

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 :)

# March 10, 2011 11:44 PM

marie123 said:

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.

# March 11, 2011 6:05 AM

Min said:

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

# October 5, 2011 2:39 PM