netdbg — Getting started
Debug 32-bit (x86) .NET applications, such as WinForms apps built for x86, in Visual Studio Code — with many of the debugging tools you know from Visual Studio, and a few it doesn't have.
What it is
The C# extension for VS Code ships its debugger only for 64-bit and ARM64, so a process built with
<PlatformTarget>x86</PlatformTarget> cannot be debugged with it. This extension bundles its own debug engine,
netdbg (x86 and x64; the one of the program's bitness is used), and adds the debug type netdbg.
The debugger itself uses no .NET. The differences from Visual Studio and from netcoredbg (the engine of 1.x) are listed in the README.
You need
Windows (64-bit), VS Code, a .NET SDK, and the x86 .NET runtime your app uses — for WinForms / WPF that is the .NET Desktop Runtime (x86).Supported
.NET (Core), .NET 5 or later and .NET Framework 4.x, 32-bit and 64-bit processes (self-contained and single-file too): launch and attach. .NET Framework apps need no other .NET; the project must write Portable (or embedded) PDBs.Not supported
.NET Framework 2.0 / 3.5, and Windows PDBs. The debuggee's output goes to the Debug Console (no integrated terminal).Install
- Open the Releases page and download
netdbg-<version>.vsixandinstall-vsix.ps1into the same folder. - In that folder, run:
Alternatively, in VS Code run Extensions: Install from VSIX... from the Command Palette (Ctrl+Shift+P) and pick the file.powershell -ExecutionPolicy Bypass -File install-vsix.ps1 - Reload VS Code (Developer: Reload Window).
Menus and messages follow VS Code's display language: English, or Japanese with the Japanese Language Pack.
Your first debug session
.csproj files —
pressing F5 without a launch.json does the same. The steps below are what they do.1. Make the project 32-bit
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
2. Add a build task and a launch configuration
.vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [{
"label": "build", "type": "process", "command": "dotnet",
"args": ["build", "${workspaceFolder}", "-p:Platform=x86"],
"group": "build", "problemMatcher": "$msCompile"
}]
}
.vscode/launch.json (type .NET x86 in the Add Configuration... list to insert it):
{
"version": "0.2.0",
"configurations": [{
"name": ".NET x86 Launch",
"type": "netdbg",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/x86/Debug/net10.0-windows/MyApp.exe",
"cwd": "${workspaceFolder}"
}]
}
3. Set a breakpoint and press F5
Click left of a line number to set a breakpoint (a red dot), then press F5. When the app reaches the line, it stops and VS Code shows the values. Use F10 (step over), F11 (step into), Shift+F11 (step out) and F5 (continue).
PlatformTarget (AnyCPU) runs as a 64-bit process and is debugged with the x64 engine.
To debug it as x86, set <PlatformTarget>x86</PlatformTarget> and point program at bin/x86/....A tour of the screen
While stopped, the Run and Debug side bar (Ctrl+Shift+D) and the editor look like this.
- Variables — locals of the selected frame. Right-click a variable for the extension's commands.
- Autos — only the variables used on the current and previous line.
- Exception Log — every exception thrown, even those caught and swallowed (with a count badge).
- Step History — the locals at each earlier stop; changed values are marked.
- Inline values — the current values printed at the end of the lines.
- PerfTips — how long the last step or continue took.
- Breakpoint (red dot) and logpoint (diamond) in the gutter; the yellow arrow is the current line.
- Debug Console — logpoint messages, exceptions and section timings.
Features
Feature list
Grouped by what you want to do. ★ marks features Visual Studio does not have.
| Feature | What it does | Where |
|---|---|---|
| Stopping where you want | ||
| Conditions, hit counts, logpoints | Stop on a condition or the n-th pass; print without stopping | Gutter right-click |
| Temporary / dependent / when-changed breakpoints | Stop once, after another breakpoint, or when a value changed | Editor right-click |
| Caller-filtered breakpoints ★ | Stop only when a given method is a caller | Editor right-click |
| Break on value change | Stop at the line that changes a field or variable | Variables right-click |
| Exception breakpoints | Stop on thrown / unhandled exceptions, filtered by type; or check the types in a list | Breakpoints / Exception Settings view |
| UI freeze detection ★ | Pause where the UI thread is stuck | Automatic |
| Moving through code | ||
| Parallel Stacks, freezing threads | All threads' stacks merged; keep a thread suspended | Call Stack right-click |
| Step Into Target | Step into one chosen call of the line | Editor right-click |
| Set next statement | Run a line again or skip lines | Editor right-click |
| Return values | See what the methods you stepped over returned | Variables / Autos |
| Looking at values | ||
| Hovers, inline values, DebuggerDisplay, Autos | Values next to the code and in compact views | Editor / Autos view |
| Pinned values | Keep an expression at the end of a line | Editor right-click |
| Object IDs | Name an object ($1) and reach it from anywhere | Variables / Watch right-click |
| Dump, table, image, C# initializer, string viewer, snapshots | Read and compare complex values | Variables right-click |
| Time and performance | ||
| PerfTips | Time of the last step or continue at the line | Automatic |
| Section timing, value trend ★ | Time a section or chart values on every pass, without stopping | Editor right-click |
| Memory / CPU graph | Private Bytes, Working Set and CPU over time | Command Palette |
| Heap snapshots | Objects per type on the GC heap, and what grew between two stops | Call Stack right-click / Command Palette |
| GDI / USER objects, handles, address space ★ | Catch GDI leaks and a full 32-bit address space before the app crashes | Command Palette |
| GDI leak candidates ★ | Fonts, brushes, bitmaps, icons and windows that were not disposed, and which keep growing | Heap Snapshots panel |
| History and records | ||
| Step history | The locals of every earlier stop | Step History view |
| Exception log ★ | Every thrown exception, also the swallowed ones, with the stack and locals at the throw | Exception Log view |
| Session report ★ | Markdown summary of the session for a bug report | Command Palette |
| SQL log ★ | Every SQL statement run through ODP.NET / SqlClient / OleDb / Odbc with its parameter values and caller, also from your own data access component | SQL Log view |
| Capture evidence ★ | Pictures of the open forms, control values, variables, call stack and SQL as Markdown + PNG for a test report | Command Palette / Call Stack right-click |
| Generate a unit test ★ | A test that replays the stopped method call | Call Stack right-click |
| Source and symbols | ||
| Modules view | Loaded assemblies and whether symbols were found | Modules view |
| Source in another folder | Find source whose PDB path is not on this machine | launch.json / settings |
| Source Link and symbol servers | Download the sources and PDBs of NuGet packages | Automatic / Modules right-click |
| Debug decompiled assemblies | Step into exes and DLLs without symbols as C# | Automatic |
| WinForms | ||
| WinForms Controls view | The control tree of the open forms | WinForms Controls view |
| Highlight on screen ★ | Frame a control on the stopped form | Eye icon in the view |
| Break on a control event ★ | Stop in the handlers of a control's event, wherever they are | WinForms Controls right-click |
| Change control properties | Change text, visibility, colors, position or size while stopped | WinForms Controls right-click |
| Data bindings ★ | Every binding of a form with the value on each side; unconnected bindings and unsaved edits flagged | WinForms Controls view |
| Event trace ★ | Which control's event fired, in what order and how far apart, without stopping | WinForms Controls right-click |
| Starting a session | ||
| Attach, by name too | Attach to a running x86 app, or wait for it to start | launch.json |
Breakpoints, logpoints and hit counts
Right-click the gutter (left of the line numbers) to add a breakpoint, a conditional breakpoint or a logpoint. To change an existing one, right-click its dot and choose Edit Breakpoint.
| Kind | What to type | Behavior |
|---|---|---|
| Condition | order.Amount > 1000 | Stops only when the expression is true. |
| Hit count | 5 or ==5, >=5, >5, %5 | Stops on the 5th pass / from the 5th / after the 5th / on every 5th pass. |
| Logpoint | i={i} total={total} in $FUNCTION | Writes the message to the Debug Console and keeps running. {expression} is evaluated; $FUNCTION and $TID are the method name and thread id. |
>=300 instead
of pressing F5 three hundred times, or add a logpoint to print each order's total and look for the first wrong one.Temporary, dependent, when-changed and caller breakpoints
Right-click a line in a C# editor. These are ordinary breakpoints with a marker in their condition, so they show in the Breakpoints view and can be edited or removed like any other.
| Command | Condition it sets | Behavior |
|---|---|---|
| Add Temporary Breakpoint | #once | Stops once, then the breakpoint removes itself. |
| Add Dependent Breakpoint... | #after Orders.cs:42 | Does nothing until the program has stopped at the breakpoint you pick; from then on it stops normally. |
| Add Breakpoint When Value Changes... | #changed order.Status | Evaluates the expression every time the line runs and stops only when the value differs from the previous time. The old and new values are written to the Debug Console. |
| Add Breakpoint Filtered by Caller... | #caller Import.Run | Stops only when one of the methods is on the call stack (!Import.Run: unless it is). While stopped, the current call stack is offered. |
The markers can be typed into any breakpoint's condition and combined with a hit count.
Save() is called from many places, but the bug only happens after an import.
Put a breakpoint in the import, then a dependent breakpoint in Save() on it: you stop only in the saves that
follow an import.Import.Run stops.Save() runs hundreds of times when the screen opens, but
the bug is in the import. Instead of a dependent breakpoint you would have to arm first, put #caller Import.Run on the
line in Save(): it stops only in the calls the import makes.Seeing values
- Hover a variable in the editor to see its value; expand objects in the tooltip.
- Inline values appear at the end of the lines of the current method (locals, parameters and fields; properties are not
evaluated, to avoid running getters). Turn off with the VS Code setting
debug.inlineValues. - DebuggerDisplay: types with
[DebuggerDisplay("Name = {Name}")]are shown with that text everywhere, as in Visual Studio.List<T>showsCount = 3. - The Autos view lists the variables of the current and previous line, so you do not have to search the whole Locals tree.
- Debug.WriteLine / Trace.WriteLine output appears in the Debug Console, with a link to the line that wrote it.
Pinned values
Right-click a line and choose Pin Value to Line... to keep an expression at the end of that line. It is evaluated again in the selected stack frame every time the program stops, so you can watch a value next to the code instead of in the Watch view. Pins are kept with the workspace. Remove them with Unpin Value from Line or .NET x86: Clear All Pinned Values.
Return values
After Step Over or Step Out, the values returned by the methods that were called are shown at the top of the Variables and Autos views — no need to store them in a temporary variable first. A line with several calls shows each of them.
DebuggerDisplay is not applied to them). The values
are shown only at the stop right after the step and disappear on the next step or continue. Calls that end at a breakpoint
inside them are not shown, nor are methods returning decimal, DateTime, Nullable<T> or a struct
larger than 4 bytes (on x86 these values travel through a hidden buffer).if (IsValid(order) && HasStock(order)) takes the wrong branch. Step over it and
read which of the two returned false.Variables view commands
Right-click a variable in the Variables view while stopped:
| Command | What it does | Typical use |
|---|---|---|
| Dump Variable | Opens the whole object as JSON in an editor. List / Dictionary are shown as their items. | Read a deep object at once, search it with Ctrl+F, paste it into an issue. |
| View as Image | Shows a System.Drawing Image, Bitmap or Icon as a picture, with zoom and its size and pixel format. | See what a chart or a scanned page looked like at that moment, before it was drawn on screen. |
| View as Table | Shows a List<T>, array, Dictionary or DataTable as a sortable, filterable table; copy or save as CSV. | Check 500 rows loaded from a database; sort by amount to find the odd one. |
| Copy as C# Initializer | Copies the value as C# code: new Order { Id = 1, Customer = "A", … }. | Turn the data that caused a bug into a unit test. |
| View String | Opens a string pretty-printed as JSON, XML, HTML or plain text. | Read an API response or a generated XML file held in a variable. |
| Take Snapshot / Compare with Snapshot | Records the value, then shows a diff against its current value. | See what one button click changed in a settings object. |
Break on value change
Right-click a field, property or local in the Variables view and choose Break on Value Change. Execution stops right after the value changes and the reason shows the old and new value.
x = …, x += …, x++), checks the value before and
after each of them, and stops only if it changed. Writes through ref / out, from another object
(other.x = …) or from code outside the workspace are not detected; the same name is watched for every instance.Cancelled and you do not know who sets it.
Break on value change takes you straight to the line.Set next statement
While stopped, right-click a line of the method that is executing and choose Jump to Cursor. The yellow arrow moves there without running the lines in between — run a line again after fixing a value, or skip a call you do not want.
Only lines inside the executing method can be targets, and the runtime refuses moving into or out of a catch /
finally block; you then get a message explaining why.
Parallel Stacks and freezing threads
Right-click in the Call Stack view and choose Show Parallel Stacks to see all threads' stacks merged into boxes (callers at the bottom, with the number of threads per box). Right-click a thread and choose Freeze Thread to keep it suspended while the others run; Thaw Thread lets it go again.
Monitor.Enter under different callers — a deadlock. Freeze one worker to check whether the other then finishes.Step into a specific call
On a line such as Outer(Inner1(), Inner2()), right-click and choose Step Into Target, then pick the call. The
other calls run without stopping. The calls are listed in the order they run; if the picked one is not called after all, the
step ends on the next line.
Inner2 runs Inner1 without stopping.Save(Validate(order), BuildAudit(user)) saves wrong data and you suspect
Save. With Step Into you would first walk through Validate and BuildAudit and step out of each;
Step Into Target → Save takes you straight there.Exceptions
- In the Breakpoints view, tick All Exceptions (when thrown) or User-Unhandled Exceptions. Right-click one and
choose Edit Condition to limit it to types:
System.NullReferenceException, System.InvalidOperationException, or!System.OperationCanceledExceptionfor “all but this”. - The Exception Settings view lists common exception types by namespace, as in Visual Studio. Check the types to stop on when thrown; add your own with +, or right-click an Exception Log entry and choose Break When This Type Is Thrown.
- The Exception Log view lists every thrown exception — type, message, the first line in your code — even when it is
caught and ignored, without stopping. Click an entry to open the line; expand it for a snapshot taken at the throw —
the call stack and the locals of the first frames of your code. The Debug Console gets
Exception thrown: …lines as in Visual Studio.
FormatException
swallowed by an empty catch.UI freeze detection
While the program runs, the extension checks a few times a second whether its UI threads still process window messages.
When one has not for 2 seconds (netdbg.uiFreeze.thresholdMs), the program is paused on that thread: the Call Stack
shows the code that holds the UI up, and the pause reads UI not responding for 2.0 s. Stops at breakpoints and steps never
count. If the top frames are framework code (e.g. Thread.Sleep, a lock), select your own frame further down.
Turn it off with netdbg.uiFreeze.enabled.
- When the UI thread has not answered for
netdbg.uiFreeze.thresholdMs(2 s), the program is paused on that thread. - Pick the first frame of your own code below the framework frames: that is what holds the UI up.
Time and performance
PerfTips
After each step or continue, the stopped line shows ≤ 12 ms elapsed. Step over calls one by one to see which is slow.
Section timing
Right-click a line, choose Start Timer Here... and name it; right-click a later line and choose End Timer Here.... Every pass is timed without stopping and charted in the Value Trend view.
Value trend
Right-click a line, choose Track Value at This Line... and enter expressions such as total; items.Count.
Each pass records the values without stopping and charts them per expression.
Memory / CPU graph
Run .NET x86: Show Memory / CPU Graph to watch Private Bytes, Working Set and CPU usage once per second.
Stopped periods are shaded. Set netdbg.memoryGraph.autoOpen to open it with every session.
Below them are two things Visual Studio does not chart: GDI / USER objects and handles (a process may hold 10,000 of each kind of object; the limit line appears past half of it), and the 32-bit address space in use against its 2 GB / 4 GB limit, with the largest free block. A warning appears at 80 % of the GDI / USER limit, and when the address space is 85 % full or its largest free block is under 128 MB.
Font created in the print handler is never disposed.Heap snapshots
While stopped, right-click in the Call Stack view and choose Take Heap Snapshot (or run .NET x86: Take Heap Snapshot):
the number of objects and their bytes per type on the GC heap are listed, largest first, as in Visual Studio's Memory Usage.
Take another snapshot at a later stop to see the change of each type (Δ Count, Δ Size); pick any two snapshots to compare,
sort by a column, filter by name or show Increases only. A garbage collection runs right before each snapshot so that only
objects still in use are counted (netdbg.heapSnapshot.collectGarbage, or the checkbox in the panel).
Above the types, GDI leak candidates lists the objects that hold a native resource (GDI+ fonts, brushes, pens, images, graphics, regions, paths; icons, cursors, windows), how many are not disposed — they still hold their handle — and the change since the snapshot compared with. A type whose Not disposed keeps growing is marked ⚠ leak candidate. Visual Studio cannot tell a disposed object from one that was not.
System.Drawing.Font shows Δ Not disposed +3. The print handler creates a font per page and never
disposes it; a using fixes it.Step history
The Step History view keeps the locals of every stop (newest first). Values that changed since the previous stop in the same method are marked changed / new. Click an entry to open its location. It is a history to look at, not a way to run backwards.
Source Link and symbol servers
When the program stops in a file that is not on this machine and the PDB has a Source Link map — most NuGet packages built from GitHub do — the file is downloaded and opened, so you can step through the package's real source. For a DLL without symbols, right-click it in Modules and choose Download Symbols to fetch its PDB from the NuGet / Microsoft symbol servers (from the next session). If no server has it, the debugger decompiles it.
Debugging decompiled assemblies
An exe shipped without its PDB, or a DLL of the program whose source you do not have, is decompiled to C# by the debugger itself
when you stop in it or step into it: the call stack points at the decompiled files, and breakpoints, stepping and locals work in the
same session, with no .NET runtime needed. Methods that cannot be turned into C# are shown as IL. When the program has its PDB, a DLL
without symbols is not your code: set "justMyCode": false to step into it. "decompile": "off" turns it off.
ArgumentException from deep inside, and the message
does not say which value it rejects. Turn Just My Code off, step into the call, and stop on the throw line: the locals show the value.Object IDs
Right-click an object in Variables or Watch and choose Make Object ID. The object gets a name, $1, that reaches it
from any method and any later stop: in Watch, the Debug Console and breakpoint conditions ($1.Count, order == $2).
Values that are that object show {$1}. Like in Visual Studio, the ID does not keep the object alive.
- The object now shows
{$1}wherever it appears. - Watch
$1from any frame — here it has grown to 3 items. - Use it in a condition: stop in
Addonly when it adds to this very list.
items == $1 on the line that adds items: you stop only for that cart.Generate a unit test from a stop
Right-click a frame in the Call Stack view and choose Generate Unit Test from Here. A test that calls the method again with
its current arguments (and object) opens beside the editor, in the framework your projects use (xUnit, NUnit or MSTest). Fill in
expected and save it in your test project. Stop at the first line of the method to capture the arguments as they came in.
- Right-click the frame of the method to test.
- The object and the arguments are written as C# with the values they have now.
- Fill in the expected value and save the test in your test project.
Total(),
generate the test and fill in the right total: the bug is now a failing test, and stays covered after the fix.SQL log
The SQL Log (.NET x86) view lists every SQL statement the program runs through an ADO.NET provider — ODP.NET (managed and unmanaged), SqlClient, OleDb and Odbc — without stopping: the statement, its parameter values, the caller and, expanded, the call stack. It hooks the provider, not your code, so statements run by a home-made data access component that wraps ODP.NET are logged too, with your method as the caller.
- Copy SQL with Parameter Values (right-click) gives the statement with every
:name/@name/?replaced by its literal value — strings quoted, dates asTO_TIMESTAMP(...)for Oracle, binary asHEXTORAW/0x...— ready to paste into SQL Developer or SSMS. Placeholders in string literals and comments are left alone, and Oracle'sBindByName = false(the default: bind by position) is honored. A stored procedure becomes theBEGIN ... END;/EXECthat runs it. - Copy SQL copies the statement as the program sent it.
- Export SQL Log (view title) writes every statement, with its time, caller and values, to a
.sqlfile.
Each statement pauses the program for a moment while it is read (about a few hundred milliseconds), so leave it off
(netdbg.sqlLog.enabled) when timing. To log another provider, add its command type to netdbg.sqlLog.methods,
e.g. Npgsql.NpgsqlCommand.ExecuteReader. The time a statement took is not recorded; ...Async methods are logged only
where the provider calls its synchronous method.
:since date is a day off, and the caller shows which method built it.Session report
Run .NET x86: Export Debug Session Report (or click the button in the Step History view title) to open a Markdown summary of the last session: program, start / end time and exit code, every stop with the values that changed, the exceptions (with a count per type), section timings, tracked values and the modules with symbols.
Capture evidence
While stopped, run .NET x86: Capture Evidence (Command Palette, Call Stack context menu, or the camera button in the WinForms
Controls view title). Everything a test report needs from that screen goes into a new folder, evidence/<date-time>/
in the workspace (netdbg.evidence.folder), as evidence.md plus a PNG per form:
- a picture of every open form — the desktop compositor's last image of the stopped window, shown on top for a moment and copied, so it works when the form is behind VS Code (the form must be on a screen, not minimized);
- the controls of each form with their text, the value of input controls (checked, selected index, numeric and date values), hidden / disabled state, and the first 20 rows × 10 columns of every DataGridView;
- where it stopped (with the line of code), the variables of the selected frame and the call stack;
- the SQL run since the previous capture, with the values filled in (from the SQL log).
Reading the controls takes a few evaluations each: at most 300 controls are read per form, and the progress notification can cancel it.
Source in another folder
To step into your own library whose PDB records source paths that are not on this machine (e.g. a NuGet package you
build elsewhere), add a parent folder of its source to sourceSearchPaths in launch.json (searched with subfolders),
or replace a path prefix with sourceFileMap (e.g. { "/_/": "D:\\work\\MyLib\\" }). Both can also be set for
every configuration in the settings (netdbg.sourceFileMap / netdbg.sourceSearchPaths). When a stop has
no source here, the Debug Console says which path to map. For a library without symbols, see decompiling.
sourceSearchPaths, and step into the library with its real source.Modules
The Modules view lists the loaded assemblies and whether their symbols (PDB) were found. If a breakpoint stays hollow, check here that your assembly shows symbols loaded.
WinForms controls
While stopped, the WinForms Controls view (collapsed at the bottom of Run and Debug) shows the open forms and their controls as a tree: name, type and text, with hidden controls greyed out. Hover a control for its bounds, enabled state, dock and tab index. Right-click it to Dump Control or Copy Expression; the expression can be pasted into the Watch view.
Right-click a control and choose Break on Event... to list the handlers attached to its events, lambdas included, and stop in the ones you pick the next time the event fires — useful in old code where nobody knows which method handles the button.
Right-click a control and choose Change Property... to change its text, visibility, colors, position or size in the stopped
program — try a fix without rebuilding. It shows on screen when the program continues. Dock and Anchor take member names (Fill, Top, Left).
Click the eye icon (Highlight on Screen) to frame a control on the screen: the form is shown in front, as it was when the program stopped, with a red frame, the control's name and its size for a few seconds.
- Click the eye icon of a control in the WinForms Controls view.
- The form is shown in front as it was when the program stopped, with a red frame, the name and the size.
The link icon in the view title (Show Data Bindings), or the same command on a control, lists the data bindings of the open forms (or of that control and the ones inside it) — which Visual Studio cannot show. Simple bindings show the control property, the data source and member, the value in the control and the value in the current item side by side, the position in the list, the update mode and the format string; list bindings (ComboBox, ListBox, DataGridView) show DataSource, DisplayMember, ValueMember, the selected value and the position. ⚠ not connected marks a member that does not exist, ≠ differs a control that shows something else than its item holds.
OnValidation: the record changed before the box was
validated, so the edit was never written back.okButton exists and is visible, yet nobody can see it. Highlight it: the frame
shows it sitting under another panel, or squeezed to a few pixels at the edge of the form.Event trace
Right-click a control in the WinForms Controls view, choose Trace Events... and pick its event handlers (all are picked).
Continue and use the form: the Event Trace (.NET x86) view lists every firing in order, oldest first — the event, the control
that fired it (the handler's sender), the handler, the time and the gap to the previous firing. Nothing stops. Click an entry to
open the handler; Export Event Trace writes the list to a text file; Clear Event Trace also stops tracing. Trace several
controls to see how their events interleave. A handler you also set a breakpoint on still stops there.
TextChanged of
qtyBox, then Validating, then SelectedIndexChanged of priceCombo set by the first handler — the
chain that runs the calculation again.Attaching to a running app
Use an attach configuration. The process list shows only x86 .NET processes with their window titles; choose
Show all processes... for everything else.
When an app is started by something else (a launcher, a scheduled task) and you need it from the very start, attach by name. Debugging waits until the process appears:
{
"name": ".NET x86 Attach (wait for process)",
"type": "netdbg",
"request": "attach",
"processName": "OrderApp",
"waitTimeout": 120
}
Use cases
Legacy x86 dependency
Your WinForms app must stay 32-bit because of an old native DLL or COM component. Debug it in VS Code exactly like a 64-bit app.“It just shows nothing”
Exception Log finds the exception swallowed bycatch { }; click it to open the line.Wrong value after many items
Track the value at the loop line, look at the chart, then set a hit count to stop right before it goes wrong.Who changed this?
Break on value change stops at the line that modifies a field.Is this slow?
Use PerfTips while stepping, then section timing to measure the suspicious part on every pass.Reproduce a bug in a test
Copy as C# Initializer turns the live data into code for a unit test.Check loaded data
View as Table shows the List or DataTable as rows; sort, filter, save as CSV.App launched by another program
Attach withprocessName and debug it from its first moments.Which call returned false?
Step over the condition and read the return values in Variables.Where did my control go?
The WinForms Controls view shows its parent, bounds and visibility.Write up a bug
Export the session report and attach it: stops, changed values and exceptions in one file.UI freezes now and then
UI freeze detection pauses the program in the code that holds the UI thread.Only from this caller
#caller stops a shared method only when a given method called it.Skip to the call you care about
Step Into Target enters one call of a line and runs the others.Follow one object
Make Object ID, then use$1 in Watch and conditions anywhere.Turn a stop into a test
Generate Unit Test from Here writes the method call with the current values.A library without source
Step into it: the debugger decompiles it to C#.Library built on another machine
PointsourceSearchPaths at your clone.Which SQL ran, with which values?
The SQL Log shows every statement with its parameters, also through your own data access layer; copy it with the values filled in.Evidence for the test report
Capture Evidence saves the form pictures, field values and the SQL in one Markdown file.Events fire in a strange order
Trace the controls' events and read the order and the gaps without stopping.Troubleshooting
| Symptom | What to do |
|---|---|
| “… is a Windows PDB, which this debugger cannot read” | Add <DebugType>portable</DebugType> to the .NET Framework project and rebuild. |
| The program runs as 64-bit, but should be x86 | Set <PlatformTarget>x86</PlatformTarget> and point program at bin/x86/.... |
| “The x86 dotnet.exe was not found” | Install the x86 .NET runtime (for WinForms: .NET Desktop Runtime x86). |
| Breakpoint stays hollow | Check the Modules view: your assembly needs symbols loaded (Debug build, PDB next to the DLL). |
| Can’t step into your own library / “Source not found: …” in the Debug Console | Its PDB records a path that is not on this machine: add a parent folder of the source to sourceSearchPaths, or map the path prefix with sourceFileMap (and set justMyCode to false for a Release build). |
| The Variables view is missing | It may have been hidden or moved: run Run and Debug: Focus on Variables View. |
| Something else is wrong | Enable netdbg.trace, reproduce, and attach the “netdbg” output to an issue. |
Settings
| Setting | Default | Meaning |
|---|---|---|
netdbg.exceptionLog.enabled | true | Record every thrown exception (slower for apps that throw very many). |
netdbg.uiFreeze.enabled / thresholdMs | true / 2000 | Pause the program when its UI does not respond for this long (ms). |
netdbg.perfTips.enabled | true | Show the elapsed time after steps. |
netdbg.stepHistory.enabled | true | Record every stop in Step History. |
netdbg.memoryGraph.autoOpen | false | Open the memory / CPU graph when debugging starts. |
netdbg.heapSnapshot.collectGarbage | true | Run a garbage collection before each heap snapshot. |
netdbg.dump.maxDepth / maxNodes | 3 / 2000 | Limits of Dump Variable and related commands. |
netdbg.sourceFileMap / sourceSearchPaths | (empty) | Where the source of referenced assemblies is, for every configuration (merged with launch.json). |
netdbg.trace | false | Troubleshooting log of the debugger communication. |
netdbg.debuggerPath | (empty) | For x86 programs, use another build of the x86 debug engine (netdbg.exe) instead of the bundled one. netcoredbg is not supported. |
netdbg.sqlLog.methods | ODP.NET, SqlClient, OleDb, Odbc | Provider methods the SQL log reads commands at (Namespace.Type.Method). |
netdbg.evidence.folder | evidence | Where Capture Evidence saves (relative to the workspace folder). |
Turning features off
Every feature is on by default (true). false removes its views, menu entries and commands, and stops the work it does in the background.
| Setting | Feature |
|---|---|
netdbg.memoryGraph.enabled | Memory / CPU / GDI graph (no sampling at all) |
netdbg.inlineValues.enabled | Inline values |
netdbg.autos.enabled | Autos view |
netdbg.modules.enabled | Modules view, Download Symbols |
netdbg.exceptionSettings.enabled | Exception Settings view (and stopping on the types checked in it) |
netdbg.winforms.enabled | WinForms Controls view and its commands, Show Data Bindings |
netdbg.heapSnapshot.enabled | Heap Snapshots and GDI leak candidates |
netdbg.parallelStacks.enabled | Parallel Stacks, Freeze / Thaw Thread |
netdbg.valueTrend.enabled | Value trend and section timing |
netdbg.pinnedValues.enabled | Pinned values (kept, shown again when turned back on) |
netdbg.breakpointCommands.enabled | The breakpoint commands of the editor context menu (the #once / #after / #changed / #caller conditions keep working) |
netdbg.variableTools.enabled | Variables / Watch context menu commands (Dump, View as Table / Image, Copy as C#, View String, snapshots, Object ID) |
netdbg.generateTest.enabled | Generate Unit Test from Here |
netdbg.sessionReport.enabled | Export Debug Session Report |
netdbg.stepHistory.enabled | Step History view and recording |
netdbg.exceptionLog.enabled | Exception Log view and recording |
netdbg.perfTips.enabled | PerfTips |
netdbg.uiFreeze.enabled | UI freeze detection |
netdbg.sqlLog.enabled | SQL Log view and recording |
netdbg.eventTrace.enabled | Trace Events and the Event Trace view |
netdbg.evidence.enabled | Capture Evidence |
netdbg.sourceLink.enabled | Source Link downloads |
netdbg · MIT License · GitHub