Boxes'n'Lines .NET Diagrams
See a flow diagram of the C# method you're working in, right inside VS Code. Put your cursor in a
method and the Method Diagram panel draws its branches, loops, try/catch, returns and throws.
Move to another method and the diagram follows you.
The Method diagram is free. With an Individual or Team licence
the Full flow view follows the calls into the rest of your project, so you see what the whole
request does, not only this one method.
Your code never leaves your machine: diagrams are generated locally by the analyser bundled with the
extension, and the extension collects no telemetry. The only network request is the licence check
described under Full flow, and it is made only if you hold a licence key.
Requirements
- A .NET SDK on your machine, as for any C# development. The analyser uses it to load your projects.
- The C# extension (installed automatically as a dependency). C# Dev Kit works too.
Nothing else to install. The analyser needs a .NET 10 runtime to run; if you don't have one, the
extension asks Microsoft's .NET Install Tool (the one the C# extension uses) to download it the
first time. That download is made by Microsoft's tool, not by this extension.
Using it
- Open a folder containing a C# project and open a
.cs file.
- Open the Method Diagram tab in the bottom panel, or run Boxes'n'Lines: Show Method Diagram.
- Click inside a method. After a few seconds its diagram appears.
In the panel: drag to pan, scroll to zoom, double-click (or Fit) to fit the diagram to the pane.
The diagram follows your code, and the code follows the diagram: the node for the line your cursor is on
is highlighted (and scrolled into view if it's off-screen), and clicking a node moves your cursor to its
code. A node that calls another method takes you to the call. While the file has unsaved changes the
highlighting pauses, because the diagram describes the saved file.
Advanced Diagram opens the advanced version of the diagram (see below). Open as Code shows the diagram as Mermaid code in a new tab, to read, copy, or save (File > Save) as a
.mmd file or into a README: GitHub draws a mermaid code block there.
Advanced Diagram
Advanced Diagram turns the diagram on screen into the advanced format: the flowchart plus every variable's
reads and writes, drawn as lanes you can follow through the method. The Method view gives the single method;
Full flow gives the whole call chain, a pane per method. The extension writes a .drawio file (into its own
storage; use File > Save As in draw.io to keep a copy) and opens it in the
draw.io extension
(Draw.io Integration, by Henning Dieterichs), a separate extension under its own terms. If it isn't
installed, you are asked whether to install it; the extension never installs anything unasked. Prefer another
way? Choose Show the file instead and open the .drawio file in the draw.io desktop app or
app.diagrams.net. The free plan's diagram carries a small Boxes'n'Lines logo; a
licence removes it.
Full flow (licensed)
The Method diagram stops at the method's own boundary: a call into another method of your project is a
single purple node. Switch the panel to Full flow and those calls are expanded, level by level, into the
whole chain of calls through your classes (bnlDiagrams.fullFlowDepth sets how many levels). It needs an
Individual or Team licence. On the free plan the Full flow
button carries a lock, and clicking it offers to enter a key or to get one.
To unlock it, run Boxes'n'Lines: Enter Licence Key (or click the licence badge in the panel's top bar)
and paste the key from your purchase email; if you've lost it,
have it sent again. The badge then shows your tier, and
clicking it shows who the licence is for and when it ends.
The key is checked on your machine and kept by the bundled analyser, in the same place the bnl-dotnet
command-line tool keeps it, so activating it in one covers the other; the extension never stores the key
itself. As the licence nears its renewal date the analyser checks in with our licence server, sending only
the key, to pick up a renewal. Nothing about your code is sent.
Full flow diagrams aren't linked to your code yet: they have no cursor following or click-to-jump (the
Method diagram has both). Open as Code works for both.
Good to know
- Generating a diagram takes a few seconds, because the project is loaded each time. A spinner
shows while it works and the previous diagram stays visible, dimmed, until the new one is ready.
- Diagrams you've already seen are remembered and appear instantly until you save a C# file.
- The diagram reflects what's saved on disk. The panel tells you when you have unsaved changes.
- Nothing runs while the panel is hidden.
- On the free Method diagram, calls into other methods of your project appear as single purple nodes.
- Under a Method diagram that contains such calls there is a one-line note with a Show Full flow link
(on the free plan, from your third diagram on, so a newcomer isn't greeted with it). Click ✕ to hide it
for good, or set
bnlDiagrams.showUpgradeHint to false. The extension sends nothing and counts
nothing remotely; Get a licence just opens the pricing page in your browser.
Settings
| Setting |
Default |
|
bnlDiagrams.executable |
(empty) |
Empty uses the analyser bundled with the extension. Set a command or full path to use your own bnl-dotnet instead. |
bnlDiagrams.project |
(empty) |
The .sln, .slnx or .csproj to analyse. Empty means the nearest .csproj above the current file. |
bnlDiagrams.debounceMs |
400 |
How long the cursor must rest in a method before generating. |
bnlDiagrams.timeoutSeconds |
120 |
Give up on a diagram that takes longer than this. |
bnlDiagrams.followCursor |
true |
Highlight the diagram node for the cursor's line and scroll it into view. Clicking a node always moves the cursor. |
bnlDiagrams.fullFlowDepth |
25 |
Full flow only: how many levels of calls to follow. 1 draws just the method; fewer levels draw a smaller, quicker diagram. |
bnlDiagrams.showUpgradeHint |
true |
Show the one-line note about Full flow diagrams under diagrams that call other methods. |
Commands
- Boxes'n'Lines: Show Method Diagram - opens the panel and draws the current method.
- Boxes'n'Lines: Refresh Method Diagram - clears remembered diagrams and regenerates.
- Boxes'n'Lines: Open Diagram as Mermaid Code - the same as the panel's Open as Code button.
- Boxes'n'Lines: Open Advanced Diagram in draw.io - the same as the panel's Advanced Diagram button.
- Boxes'n'Lines: Enter Licence Key - paste the key from your purchase email to unlock Full flow.
- Boxes'n'Lines: Show Licence - the same as clicking the licence badge: your tier, its end date, and the links to enter a key or get one.
- Boxes'n'Lines: Get a Licence - opens the pricing page in your browser.
Known limitations
- Overloaded methods are told apart by their parameter list; if you see the wrong overload, please
tell us.
- Two types with the same simple name in one project can't be told apart.
- Linking the diagram to your code needs the analyser's
--format json, which the bundled analyser has.
If you point bnlDiagrams.executable at an older bnl-dotnet, diagrams still draw but the links are off.
- The diagram always sits on a dark background, because the generated colours assume one.
- If .NET can't be downloaded (for example behind a restrictive proxy), install a .NET 10 runtime
yourself from https://dotnet.microsoft.com/download and click Refresh.
Support
https://boxesnlines.com/contact
Licence
See the LICENSE.txt included with the extension. The Method diagram is free to use; Full flow needs a
licence.
Developing (this folder lives in the diagramgenerator repository)
cd vscode
npm install
npm run bundle:cli # publishes ../src/DiagramGenerator.CSharp.Cli into ./cli (needs the .NET 10 SDK)
npm run compile # type-check, lint, bundle to dist/ (also copies mermaid.min.js)
Press F5 (Run Extension) with this folder open, then open a C# file in the Extension
Development Host and open the Method Diagram panel tab. The Boxes'n'Lines Diagrams output
channel logs which .NET host and analyser it found.
npm run vsix builds the installable package. CI is .github/workflows/ci-vscode.yml; a release is
a bnl-dotnet-vscode-v<version> tag (see .github/workflows/release-vscode.yml).