CodeGraphToDgml
Code Graph to DGML is a Visual Studio extension that visualizes code relationships from the symbol at the editor caret — as DGML graphs or Mermaid sequence diagrams.
Features
Traverse Up to DGML
- traverses callers upward from C# and Visual Basic methods, properties, and events
- limits traversal by maximum depth and node count
- filters properties, events, external symbols, and generated code
- discovers forms, pages, and windows that host UI components (WinForms, WebForms, WPF, Blazor, MAUI, Avalonia) and adds them with UsedBy links
- follows nested component hosting up to a configurable depth
Traverse Down to DGML
- traverses callees downward from C# and Visual Basic methods, properties, and events
- follows interface implementations and overridden base members so the graph reflects the methods that may actually run at each call site
- limits traversal by maximum depth and node count
- filters properties, events, external symbols, and generated code
Traverse Down to Sequence
- traverses callees downward from C# and Visual Basic methods, properties, and events and builds a Mermaid sequence diagram
- follows interface implementations and overridden base members so the diagram reflects the methods that may actually run at each call site
- limits traversal by maximum depth and node count
- filters properties, events, external symbols, and generated code
- outputs Markdown (
.md), HTML, or both — configurable in Tools → Options → Code Graph to DGML
- Markdown opens directly in Visual Studio's built-in preview; HTML opens in the default browser with zoom and scroll support
All References to DGML
- mirrors Visual Studio's built-in
Find All References (Shift+F12) for the symbol at the caret
- supports C# and Visual Basic types (class, struct, interface, record) and members (methods, properties, events, fields)
- adds a
References link from each enclosing referrer (method, property, event, field, or type) to the target symbol
- limits traversal by maximum depth and node count and respects the external symbol and generated code filters
Common
- reports progress in the status bar and a cancellable modal dialog
- writes execution details to a dedicated Output window pane
- DGML commands append to or replace an open DGML document; a temporary document is created when none is open
Usage
- Open a C# or Visual Basic file in Visual Studio.
- Place the caret on a method, property, event, field, or type name.
- Right-click to open the context menu.

- Choose one of the commands. DGML commands open the result in the DGML editor; Traverse Down to Sequence opens a Mermaid diagram in Visual Studio's Markdown preview and/or the default browser.

Configuration
Settings are managed under Tools → Options → Code Graph to DGML.
In Visual Studio 17.x and later the new unified Options page shows a notice that settings haven't been migrated yet. Click General to open the legacy dialog where the actual settings live.


| Setting |
Default |
Description |
| Output format |
Html |
Output format for Traverse Down to Sequence: Markdown, Html, or Both. |
| Stacked activation bars |
False |
When enabled, overlapping activation bars in sequence diagrams are stacked instead of merged. |
| Include component hosts |
True |
Discover and add forms, pages, and windows that host UI components (WinForms, WebForms, WPF, Blazor, MAUI, Avalonia). |
| Include events |
True |
Traverse event members during graph or diagram construction. |
| Include external symbols |
False |
Follow calls into external assemblies (outside the solution). |
| Include generated code |
False |
Traverse compiler-generated or designer-generated members. |
| Include properties |
True |
Traverse property getters and setters. |
| Maximum depth |
16 |
Maximum traversal depth for callers or callees. |
| Maximum host depth |
3 |
Maximum depth when following nested component hosting chains. |
| Maximum node count |
1024 |
Hard cap on nodes added to a graph or diagram before traversal stops. |
| Activate result document |
True |
Bring the DGML or Markdown document to the front after it is updated. |
| Show detailed output |
True |
Write verbose execution details to the dedicated Output window pane. |
Prerequisites
The DGML editor is required for the three DGML commands. It is included by default in Visual Studio Enterprise. For Community or Professional editions it must be installed separately:
- Open Visual Studio Installer.
- Click Modify on your Visual Studio installation.
- Switch to the Individual components tab.
- Search for DGML editor.
- Check the component and click Modify to install it.

Without the DGML editor, Visual Studio cannot open or display .dgml files. Traverse Down to Sequence does not require the DGML editor.
| |