dotnet-debug.nvim is a Neovim plugin that provides a flexible Debug Adapter Protocol (DAP) configuration for debugging .NET applications. It's designed to be debugger-agnostic, allowing users to integrate their preferred .NET debugger, such as vsdbg-ui or netcoredbg, with Neovim's DAP client. The plugin primarily focuses on enabling .NET debugging workflows, including specific support for Android targets.
This plugin sets up the necessary DAP adapters and handlers to connect Neovim to your chosen .NET debugger, facilitating features like breakpoints, stepping, variable inspection, and console output within your Neovim environment.
- Debug a .NET Core/ASP .NET Core project
- Debug a .NET for Android project
- Neovim
- nvim-dap - DAP client for Neovim
- netcoredbg - .NET Core debugger
Assuming you are using lazy.nvim, add the following to your plugin configuration:
-- lazy.nvim minimal configuration
return {
"kmiterror/dotnet-debug.nvim",
dependencies = { "mfussenegger/nvim-dap" },
-- For full configuration, see the examples below.
config = function(_, opts)
require("dotnet-debug").setup(opts)
end,
}dotnet-debug.nvim is configured by passing options to its setup() function. The most critical options are debugger_path (the path to your chosen .NET debugger executable) and optionally signer_path (required by some debuggers like vsdbg-ui for handshake signing).
This example shows how to configure dotnet-debug.nvim to use vsdbg-ui, typically found within a Visual Studio Code C# extension installation.
-- lazy.nvim configuration example for vsdbg-ui
return {
"kmiterror/dotnet-debug.nvim",
dependencies = { "mfussenegger/nvim-dap" },
opts = {
-- Path to the signing module.
-- This is typically found within the Visual Studio Code.app bundle on macOS.
signer_path = "/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar.unpacked/vsda/build/Release/vsda.node",
-- This path is often found within the ms-dotnettools.csharp extension for VS Code.
-- The `~` will be expanded to your home directory.
debugger_path = "~/.vscode/extensions/ms-dotnettools.csharp-x.xxx.xx-darwin-arm64/.debugger/arm64/vsdbg-ui",
},
config = function(_, opts)
require("dotnet-debug").setup(opts)
end,
}This example demonstrates configuring dotnet-debug.nvim to use netcoredbg, a lightweight, open-source .NET Core debugger. netcoredbg typically does not require a separate signer_path.
-- lazy.nvim configuration example for netcoredbg
return {
"kmiterror/dotnet-debug.nvim",
dependencies = { "mfussenegger/nvim-dap" },
opts = {
-- Path to the netcoredbg executable.
-- This can vary based on your installation method (e.g., global install, specific version).
-- IMPORTANT: You must update this path to your actual netcoredbg installation.
debugger_path = "/path/to/netcoredbg/netcoredbg",
-- netcoredbg typically does not require a separate signer, so signer_path can be omitted
-- or set to nil.
signer_path = nil,
},
config = function(_, opts)
require("dotnet-debug").setup(opts)
end,
}Here are example launch.json configurations for different .NET application types. You should place this file in your project's .vscode directory.
For debugging ASP.NET Core web applications:
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/src/<YOUR_PROJECT_NAME>.Server.Core/bin/Debug/net10.0/<YOUR_PROJECT_NAME>.Server.Core.dll",
"args": ["--interpreter=vscode"],
"cwd": "${workspaceFolder}/src/<YOUR_PROJECT_NAME>.Server.Core",
"stopAtEntry": false,
"env": {
"ASPNETCORE_URLS": "http://0.0.0.0:5010",
"ASPNETCORE_ENVIRONMENT": "Development"
}
}For debugging .NET Android applications:
{
"name": "Launch .NET Android",
"type": "monovsdbg",
"request": "launch",
"projectPath": "${workspaceFolder}/src/<YOUR_PROJECT_NAME>.AndroidClient/<YOUR_PROJECT_NAME>.AndroidClient.csproj",
"program": "${workspaceFolder}/src/<YOUR_PROJECT_NAME>.AndroidClient/bin/Debug/net10.0-android/<YOUR_PROJECT_NAME>.AndroidClient.dll",
"cwd": "${workspaceFolder}",
"buildConfiguration": "Debug",
"adbTarget": "-s emulator-5554",
"androidAttachDebugger": true,
"androidSdbTargetPort": 50703,
"androidSdbHostPort": 50703,
"javaSdkDirectory": "/Library/Java/JavaVirtualMachines/microsoft-21.jdk/Contents/Home",
"host": "127.0.0.1",
"port": 4711,
"debugServer": 4711,
"debugPort": 50703,
"useVSDbg": true,
"platform": "android",
"configuration": "Debug",
"dotnetVersion": "10.0.100",
"targetFramework": "net10.0-android",
"justMyCode": true,
"monoDebuggerOptions": {
"ip": "127.0.0.1",
"port": 50703,
"platform": "android",
"isServer": false,
"assetsPath": "${workspaceFolder}/src/<YOUR_PROJECT_NAME>.AndroidClient/obj/Debug/net10.0-android/android/assets/;"
}
}This plugin (dotnet-debug.nvim) is a tool for integrating various .NET debuggers with Neovim's Debug Adapter Protocol (DAP) client. It does not bundle, distribute, or endorse any specific debugger.
Users are solely responsible for acquiring, installing, and complying with the licensing terms and conditions of any third-party debugger (such as vsdbg-ui, netcoredbg, or others) they choose to use in conjunction with this plugin.
The configuration examples provided in this README.md are for illustrative purposes only, demonstrating how to connect different debuggers. These examples should not be construed as an endorsement of any particular debugger or as legal advice regarding their usage or licensing. Always refer to the official documentation and licensing agreements of the respective debugger.