Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Call Graph
Call Graph

Call Graph

Jetsonsoft

|
4 installs
| (0) | Free
Draws the code you are looking at, four ways: a call tree, a control-flow diagram, a sequence diagram, and a class-collaborator diagram. Follows your caret, highlights the node you are inside, and double-click navigates back to source. C# and VB.NET.
Download

Call Graph

See what your code does, without leaving the editor.

Call Graph adds a dockable diagram window to Visual Studio that follows your caret and draws the code you're looking at — four different ways. It works on C# and VB.NET, needs no setup, and every node navigates back to source.

The Call Graph window showing a call tree

The four views

Switch between them with the buttons in the window's toolbar. All four track the caret live.

Calls — what this method reaches

A tree of everything the current method calls, and what those call in turn. Framework calls appear as dashed leaves; a method already drawn elsewhere is shown as a reference (↩) so recursion and shared helpers stay bounded.

Answers "what does this touch?" — the blast radius before you change something.

Calls view

Flow — how this method runs

A control-flow diagram of the method you're in: branches, loops with their back edges, early returns, switch arms, throws, and dashed edges into catch handlers. Consecutive plain statements merge into one box so a long method stays readable.

Answers "which paths get taken, and what escapes?"

Flow view

Sequence — the order things happen

A sequence diagram with one lane per type and one message per call site, in the order they actually run. Calls inside a loop, an if, or a try are wrapped in the matching block, so you can see what repeats and what is conditional. Discarded Task-returning calls are drawn as async arrows.

Answers "what happens, in what order?" — the view the call tree can't give you, because it deliberately collapses repeats.

Sequence view

Collaborators — what this type depends on

A class diagram of the type you're in, one hop out: its base type, the interfaces it implements, the types it holds in fields and properties, and the ones handed to its constructor. Collections unwrap to their element type, so List<Order> _pending points at Order with a 1 → * cardinality rather than at List.

Answers "what does this class need to exist?"

Collaborators view

Using it

Open the window from View ▸ Other Windows ▸ Call Graph, or click the Call Graph link in the hover tooltip over any method.

Action What happens
Move the caret The diagram follows. The node you're inside is highlighted, and the view pans to it if it's off screen.
Double-click a node Navigates the editor there. Recorded in the navigation history, so Ctrl+- comes back.
Drag / scroll wheel Pan and zoom. Fit re-centres.
↓ / → Top-down or left-right layout. (Not applicable to Sequence.)
+ framework Include types and calls from outside your solution. Off by default — otherwise every string.Format and List.Add crowds out the calls you care about. Available on Sequence and Collaborators.

The window is opened on demand and does no work while it's closed. Caret tracking is debounced, and heavy analysis runs off the UI thread.

Requirements

  • Visual Studio 2022 (17.x) or newer, any edition.
  • WebView2 runtime — ships with Visual Studio, so normally already present.

No network required. mermaid.js is bundled in the extension and served to the diagram window over a local virtual host, so it works offline and behind a corporate proxy.

Known limitations

  • Analysis is static. Everything is read from the source as written. Calls made through interfaces, delegates, reflection or DI resolve to the declared target, not the runtime one. A virtual call shows the method you wrote, not the override that will run.

  • Diagrams are capped, so a large method degrades into a readable subset rather than an unreadable wall. When a cap is hit the diagram says so.

    View Depth Size
    Calls 4 200 nodes
    Flow — 90 nodes, 4 statements per box
    Sequence 3 60 messages
    Collaborators 1 hop 40 types
  • Collaborators looks outward only. It shows what a type depends on, not what depends on it — that needs a solution-wide search, which is far more expensive than everything else here. Use Find All References for the reverse direction.

  • Sequence approximates execution order. Calls are ordered by where they close in the source, which puts arguments before the call that consumes them. Calls inside a lambda are shown where the lambda is written, not where it runs.

  • C# and VB.NET only. F# isn't in the Roslyn workspace this reads from, so it would need a separate compiler-service path.

Building from source

Requires the Visual Studio extension development workload (the VS SDK).

& "C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe" `
    CallGraph.sln /t:Restore,Build

The VSIX lands at CallGraph/bin/Debug/CallGraph.vsix. Press F5 in Visual Studio to launch the Experimental Instance with the extension loaded.

Build gotcha. The Microsoft.VSSDK.BuildTools package doesn't import the VSIX packaging targets on its own — without the explicit Microsoft.VsSDK.targets import at the end of the .csproj you get a .dll but no .vsix.

Stale MEF cache. Deploying to the Experimental Instance applies the pkgdef (so the menu and window appear) but can leave the MEF component cache stale, in which case caret tracking and the tooltip link silently never fire. Close VS, delete %LOCALAPPDATA%\Microsoft\VisualStudio\18.0_*Exp\ComponentModelCache, run devenv /rootsuffix Exp /updateconfiguration, and relaunch.

How it works

Everything is generated as Mermaid text and rendered by mermaid.js inside a WebView2. Adding a view means writing a builder and a generator; the window, the navigation and the caret tracking are shared.

Piece File Role
Package CallGraphPackage.cs AsyncPackage; registers the menu command, owns the tool window.
Caret tracking Editor/CaretTracker.cs MEF text-view listener; debounced, only works while the window is open.
Tooltip link QuickInfo/DiagramQuickInfoSource*.cs Adds the Call Graph hyperlink to Quick Info.
Symbol resolution Services/SymbolLocator.cs Resolves the method and type the caret is inside.
Bridge Services/DiagramService.cs Owns the selected view, routes to a builder, handles navigation.
Calls Model/CallGraphBuilder.cs, MermaidGenerator.cs Roslyn walk of invocations into a call tree → flowchart.
Flow Model/FlowGraphBuilder.cs, FlowMermaidGenerator.cs Structural walk of the IOperation tree → flowchart.
Sequence Model/SequenceBuilder.cs, SequenceMermaidGenerator.cs Ordered call sites with their enclosing blocks → sequenceDiagram.
Collaborators Model/CollaboratorBuilder.cs, CollaboratorMermaidGenerator.cs One-hop symbol inspection → classDiagram.
Labels Model/LabelText.cs Mermaid-safe label escaping (see the comments — it is not obvious).
Window ToolWindow/DiagramToolWindowControl.xaml(.cs) WebView2 host: rendering, pan/zoom, highlight, click-to-navigate.

The Flow view is a deliberate structural walk of the IOperation tree rather than Roslyn's ControlFlowGraph. That API gives correct lowered basic blocks, but they read like compiler IR — and the point of the view is to recognise the code you just wrote.

License

See LICENSE.txt.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft