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

Code Graph to DGML

Luciano Evaristo Guerche

|
4 installs
| (0) | Free
Visualize code relationships as DGML graphs from C# and Visual Basic editors — call hierarchies, type references, and more.
Download

CodeGraphToDgml

Code Graph to DGML is a Visual Studio extension that builds DGML graphs from the symbol at the editor caret.

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

All References to DGML

  • builds a type-reference graph from a C# or Visual Basic class, struct, interface, or record
  • discovers derived classes, interface implementations, base types, and implemented interfaces
  • traverses the reference chain up to the configured maximum depth

Common

  • appends to or replaces an open DGML document
  • creates a temporary DGML document when no target document is open
  • reports progress in the status bar and a cancellable modal dialog
  • writes execution details to a dedicated Output window pane

Prerequisites

The DGML editor is included by default in Visual Studio Enterprise. For Community or Professional editions it must be installed separately:

  1. Open Visual Studio Installer.
  2. Click Modify on your Visual Studio installation.
  3. Switch to the Individual components tab.
  4. Search for DGML editor.
  5. Check the component and click Modify to install it.

Without the DGML editor, Visual Studio cannot open or display .dgml files generated by this extension.

Solution Layout

  • src/CodeGraphToDgml.Core: dependency-free graph and DGML logic
  • src/CodeGraphToDgml.Vsix: Visual Studio host integration and Roslyn traversal
  • tests/CodeGraphToDgml.Tests: unit tests for the portable core library

Build

Build the extension from the Release configuration to produce the VSIX package:

dotnet build .\CodeGraphToDgml.sln -c Release

The repository includes both CodeGraphToDgml.sln and CodeGraphToDgml.slnx.

The generated VSIX is written to src\CodeGraphToDgml.Vsix\bin\Release\net48\CodeGraphToDgml.Vsix.vsix.

Manual Test Matrix

Area Scenario Expected Result
Command visibility Open a .cs or .vb file and right-click in the editor Traverse Up to DGML is visible and enabled
Command filtering Open a non-C# and non-VB file and right-click in the editor Command is hidden or disabled
Supported symbols Place caret on a method, property, and event in separate checks Traversal starts successfully for each supported symbol kind
Unsupported caret target Place caret on whitespace, namespace, class name, or local variable Informational message is shown and no traversal runs
Depth limit Set Maximum depth to 1 and run traversal on a symbol with multiple caller levels Only direct callers are included
Node limit Set Maximum node count to 1 or 2 and run traversal Traversal stops when the node cap is reached
Symbol inclusion Toggle Include properties, Include events, Include external symbols, and Include generated code Result graph respects each option
DGML append mode Open an existing DGML file, choose append mode, run the command twice Existing graph content is preserved and duplicate nodes/links are not added
DGML replace mode Open an existing DGML file, choose replace mode, run the command Existing node/link content is replaced by the new traversal result
Target selection With one or more DGML docs open, test AlwaysAsk, AlwaysCreateNewTemporary, and ReuseActiveIfOpen Target document behavior matches the selected option
Temp document creation Run the command when no DGML document is open A temp CodeGraph-{timestamp}.dgml document is created in %TEMP%
Window activation Toggle Activate result document and rerun DGML document is activated only when the option is enabled
Progress and cancel Start a traversal large enough to observe progress, then cancel Status bar updates are shown and cancellation stops the operation cleanly
Output logging Run traversal with Show detailed output enabled Output pane shows resolved symbol, counts, target document, and errors when applicable
Packaging Build Release and inspect the output folder A VSIX is produced and can be installed into a VS 2022 Experimental Instance
All References
Command visibility Open a .cs or .vb file and right-click on a class, struct, interface, or record All References to DGML is visible and enabled
Unsupported caret target Place caret on a method, property, local variable, or whitespace Informational message is shown and no traversal runs
Derived classes Run on a base class that has derived classes Graph includes derived classes with InheritsFrom links
Interface implementations Run on an interface that has implementations Graph includes implementing types with Implements links
Base types and interfaces Run on a class that extends a base class and implements interfaces Graph includes the base type chain and implemented interfaces
Depth limit Set Maximum depth to 1 and run on a type with multi-level inheritance Only direct references are included
Component Hosts
Host discovery Place caret on a method inside a WinForms/WPF UserControl that is used on a Form, run "Traverse Up to DGML" Form appears with an orange UsedBy link to the UserControl
Nested hosting UserControl A hosted in UserControl B hosted in a Form, set Maximum host depth to 2+ All three levels appear with UsedBy chains: Form → B → A
Host depth limit Same nested setup, set Maximum host depth to 1 Only direct host (B → A) appears, Form is not discovered
Opt-out Disable Include component hosts, rerun on a method inside a UserControl No host nodes or UsedBy links appear
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft