Documentation

New here? Getting started walks through your first diagram. This page is the reference.

Install

dotnet tool install -g bnl-dotnet

Commands

CommandTierWhat it does
basic [path] Free Lists every analyzable method, in the form to type back in.
basic [path] <method> Free Diagrams one method in isolation - full LINQ decomposition and call styling, but never follows a call into another method's own diagram.
endpoint [path] Paid Lists every controller action (ASP.NET Core Web API entry point).
endpoint [path] <action> Paid Full composed diagram for one controller action - every method it reaches, spliced into one page.
method [path] Paid Lists every analyzable method - broader than endpoint, not just controller actions.
method [path] <method> Paid Full composed diagram starting from any method - the paid counterpart to basic.
license <key> - Activates a license key locally, so it's picked up by every future run.

Finding your project

Run it from the folder containing your API, the way you would dotnet build:

bnl-dotnet endpoint OrdersController.GetById

[path] is a .sln, .slnx or .csproj (or a folder containing one). Leave it out and the one in the current folder is used - a solution if there is exactly one, otherwise the one project; if there are several, you're asked to pick. With a single argument, it's treated as the project if it looks like one and as the method otherwise.

Naming a method

Write Type.Method. Add the namespace (Orders.Api.OrdersController.Get) if the same type name exists in two places, and parameter types (OrdersController.Get(int)) to pick one overload. If a name matches several methods the tool lists them and stops rather than guessing. The list commands print each method in the form to type back in.

Don't know the method's name? Run any of basic, endpoint or method with -i:

bnl-dotnet basic --interactive
bnl-dotnet endpoint -i

You get one alphabetical list (for endpoint, each controller action with its HTTP verb and route), 15 rows to a page. Use the up and down arrows to move and page, or start typing to filter the list; press Enter to generate the diagram for the highlighted entry. The equivalent typed command is printed, so you can skip the menu next time. --interactive needs a terminal, so it can't be used when output is piped, and can't be combined with --stdout or with a method name.

Output

By default the diagram is written to <Type.Method>.mmd in the current folder (.md for markdown, .drawio for advanced).

OptionWhat it does
-o, --output <path>Write to this file - or, if it's a folder (existing, or ending in /), to <Type.Method>.mmd (or .md / .drawio, to match the format) inside it. Missing folders are created.
--stdoutWrite the diagram to standard output and nothing else, so it can be redirected or piped. Can't be combined with -o.
-f, --format <mermaid|markdown|advanced>mermaid (default) is the bare diagram; markdown wraps it in a ```mermaid fence (.md) so it renders on GitHub or in a README or PR; advanced writes a variable-flow diagram for draw.io (.drawio; drawio is accepted too) - see Advanced diagrams.
--depth <n>endpoint and method only. How many levels of calls to follow (default 25); 1 draws just the starting method.
-i, --interactiveChoose the method from a menu instead of naming it - see Choosing from a menu.
-q, --quietSuppress informational output.
--verboseShow every message MSBuild produced while loading the project. A long list is otherwise summarized in one line.
--versionPrint the tool version.
bnl-dotnet endpoint OrdersController.GetById --stdout > orders-get.mmd
bnl-dotnet endpoint OrdersController.GetById -o docs/ --format markdown

With --stdout, STDOUT carries only the diagram: the license line, progress spinner and notes aren't printed at all. A successful run writes nothing to STDERR; errors (and any license warning that needs your attention) go to STDERR, and a failed run writes nothing to STDOUT. Exit codes are 0 on success and non-zero on failure. When STDOUT is piped, endpoint and method with no method print one reference per line, so bnl-dotnet endpoint | fzf works.

On Windows PowerShell 5.1, > re-encodes output as UTF-16 - use -o there (PowerShell 7 and other shells are fine).

Advanced diagrams

--format advanced (or -f advanced) draws the flowchart as a variable-flow diagram: the same steps, plus every variable's reads and writes. It's written as a .drawio file, which opens in draw.io (the desktop app, app.diagrams.net or the draw.io extension for VS Code). It's available on every plan: basic draws one method, and endpoint and method draw the whole call chain. The default mermaid format is unchanged, so you only get the extra detail when you ask for it.

bnl-dotnet basic OrderService.Create --format advanced
bnl-dotnet endpoint OrdersController.Checkout --format advanced -o docs/

See one on the Sample page - switch between Advanced and Simple to compare the same endpoint both ways. To read one:

You'll seeWhat it means
ConsoleEvery variable the method uses is listed at the top-left, each in its own colour. Parameters enter it with an arrowhead.
LanesEach variable has a lane running across the top, with a line dropping straight into every step that touches it: an arrowhead where the step reads it, a circle where it writes it.
NamesEach line is labelled with its variable's name where it meets the step.
Outputsout and ref parameters and the return value run off past the right of the flow.
Call chainsFor endpoint and method, every method gets its own pane, with its own console, in one left-to-right row in the order the flow reaches it, grouped into a pane per class. A dashed line runs from each call to the method it calls (click the call to jump there), arguments run from the call into the callee's console, and return values run back. A value passed straight through keeps its colour from method to method.
LayersThe flowchart, the variable lines and the variable names are on separate layers (in draw.io, the Layers panel, Ctrl+Shift+L), so any of them can be hidden.
LogoOn the free plan the console carries a small Boxes'n'Lines logo, standing along its height (click it in draw.io to open this site), so the console is always tall enough to hold it. With an Individual or Team license the diagram is drawn without it.

These diagrams get wide on purpose: they show how much a method, or a whole endpoint, really does.

VS Code extension

The VS Code extension (Boxes'n'Lines .NET Diagrams) is free to install, and shows the diagram of the C# method under your cursor in a Method Diagram tab in the bottom panel, and updates as you move between methods. Drag to pan, scroll to zoom, double-click to fit.

SettingWhat it does
bnlDiagrams.executableThe command to run (default bnl-dotnet).
bnlDiagrams.projectA .sln, .slnx or .csproj to analyse. Empty means the nearest .csproj above the current file.
bnlDiagrams.debounceMsHow long the cursor must rest in a method before its diagram is generated (default 400).
bnlDiagrams.timeoutSecondsGive up on a diagram that takes longer than this (default 120).
bnlDiagrams.fullFlowDepthFull flow only: how many levels of calls to follow (default 25).
bnlDiagrams.showUpgradeHintShow a one-line note under diagrams that call other methods, pointing to Full flow (default on).

Licensing

basic is free forever, with no signup. endpoint and method need an Individual or Team license. After subscribing you'll get a license key by email; activate it once with:

bnl-dotnet license dgcli_...

This persists the key locally under your user profile, so it's picked up automatically on every later run. For CI, set it as an environment variable instead:

BNL_DOTNET_LICENSE=dgcli_...

The license works fully offline day to day - the CLI checks in with the license server only as your key nears its renewal date, and only to fetch a freshly-dated key if your subscription is still active. If that check can't reach the server at all, the CLI keeps working on the last-known-good key for a generous grace period rather than breaking your pipeline over a connectivity gap - only an explicit "this subscription has lapsed" from a reachable server stops it immediately. Keys are never tied to a specific machine.

Lost your key, or want to cancel?

If you've lost the email with your key, have it sent again - it goes only to the address you paid with. You can cancel at any time in PayPal (Settings > Payments > Manage automatic payments); your key keeps working until the end of the period you've paid for. See the terms for the details.

Every run shows its license status

Every command prints a one-line status so it's always visible what tier you're running as - License: Free, License: Individual (you@example.com), or License: Team (you@example.com).