Local debugging — C#
This guide covers everything specific to debugging an Extend app written in C#. For concepts that apply to all Extend apps and languages — environment variables, VS Code debug workflow, log reading, and common issues — see the Extend local debugging guide.
Prerequisites
-
.NET SDK 8.0 or later — verify with:
dotnet --version
# Expected: 8.x.x or later -
VS Code C# extension (
ms-dotnettools.csharp, C# Dev Kit) — install from the VS Code marketplace or accept the recommended extensions prompt when you open the repository. -
AccelByte credentials —
AB_BASE_URL,AB_CLIENT_ID,AB_CLIENT_SECRET. See Environment setup in the main guide.
VS Code launch configuration
The repository ships with a ready-to-use launch configuration in .vscode/launch.json:
{
"name": "Debug: Service",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/src/<ProjectName>/bin/Debug/net8.0/<ProjectName>.dll",
"envFile": "${workspaceFolder}/.env",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
}
The exact program path is provided by the app template's .vscode/launch.json.
Steps:
- Fill in
.env(see Environment setup). - Open the Run and Debug panel (
Ctrl+Shift+D/Cmd+Shift+D). - Select "Debug: Service" from the dropdown.
- Press F5.
Other IDEs — attach to a running process
Start the app with diagnostics enabled:
export $(grep -v '^#' .env | xargs)
DOTNET_EnableDiagnostics=1 dotnet run --project src/<ProjectName>
Attach from JetBrains Rider or Visual Studio via Run → Attach to process.
Conditional breakpoint syntax
Right-click a breakpoint → Edit Breakpoint → enter a C# expression. Example:
request.UserId == "user_001"
The debugger only pauses when the condition is true.
Reading logs with jq
# Pretty-print everything
dotnet run --project src/<ProjectName> 2>&1 | jq '.'
# Show only ERROR lines
dotnet run --project src/<ProjectName> 2>&1 | jq 'select(.level == "ERROR")'
For an overview of the log format and log levels, see Reading and understanding logs in the main guide.
C#-specific troubleshooting
DOTNET_ENVIRONMENT and configuration sources
The app may read additional configuration from appsettings.json or environment-specific
variants (appsettings.Development.json). Set DOTNET_ENVIRONMENT=Development in your .env
to activate development-mode configuration.
Checking for port conflicts
ss -tlnp | grep -E '6565|8000|8080'
Kill the stale process and start again.