vscode debugging options

This commit is contained in:
Marco 2026-04-20 12:18:16 +02:00
commit 325e2f1ee9
5 changed files with 155 additions and 3 deletions

5
.gitignore vendored
View file

@ -11,8 +11,9 @@ obj/
*.log *.log
# VS Code # VS Code
.vscode/ #.vscode/
!.vscode/extensions.json #!.vscode/extensions.json
.vscode/extensions.json
!.vscode/launch.json !.vscode/launch.json
!.vscode/tasks.json !.vscode/tasks.json

9
.vscode/docker-compose.debug.yml vendored Normal file
View file

@ -0,0 +1,9 @@
services:
worktracker:
entrypoint:
- /bin/sh
- -c
command:
- while sleep 1000; do :; done
healthcheck:
disable: true

61
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,61 @@
{
"version": "0.2.0",
"compounds": [
{
"name": "WorkTracker: Debug in Docker",
"configurations": [
"WorkTracker: Debug App in Docker",
"WorkTracker: Debug Edge"
],
"stopAll": true
}
],
"configurations": [
{
"name": "WorkTracker: Debug App in Docker",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "WorkTracker: Docker Debug Prepare",
"postDebugTask": "WorkTracker: Docker Debug Down",
"program": "/workspace/bin/Debug/net10.0/WorkTracker.dll",
"args": [
"--urls",
"http://+:8080"
],
"cwd": "/workspace",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://+:8080",
"DOTNET_USE_POLLING_FILE_WATCHER": "1",
"UseHttpsRedirection": "false"
},
"sourceFileMap": {
"/workspace": "${workspaceFolder}"
},
"pipeTransport": {
"pipeProgram": "docker",
"pipeArgs": [
"exec",
"-i",
"worktracker-dev",
"sh",
"-c"
],
"debuggerPath": "/vsdbg/vsdbg",
"pipeCwd": "${workspaceFolder}",
"quoteArgs": false
},
"justMyCode": true,
"requireExactSource": false,
"console": "internalConsole"
},
{
"name": "WorkTracker: Debug Edge",
"type": "msedge",
"request": "launch",
"url": "http://localhost:8002",
"webRoot": "${workspaceFolder}",
"internalConsoleOptions": "neverOpen"
}
]
}

73
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,73 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "WorkTracker: Docker Debug Up",
"type": "shell",
"command": "docker",
"args": [
"compose",
"-f",
"docker-compose.yml",
"-f",
"docker-compose.override.yml",
"-f",
".vscode/docker-compose.debug.yml",
"up",
"-d",
"--build",
"worktracker"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "WorkTracker: Docker Debug Build",
"type": "shell",
"command": "docker",
"args": [
"exec",
"worktracker-dev",
"dotnet",
"build",
"WorkTracker.csproj",
"-c",
"Debug"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": "$msCompile"
},
{
"label": "WorkTracker: Docker Debug Prepare",
"dependsOrder": "sequence",
"dependsOn": [
"WorkTracker: Docker Debug Up",
"WorkTracker: Docker Debug Build"
],
"problemMatcher": []
},
{
"label": "WorkTracker: Docker Debug Down",
"type": "shell",
"command": "docker",
"args": [
"compose",
"-f",
"docker-compose.yml",
"-f",
"docker-compose.override.yml",
"-f",
".vscode/docker-compose.debug.yml",
"down"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}

View file

@ -25,6 +25,14 @@ Development in Docker:
- The override file keeps a containerized `dotnet watch` flow for cases where you still want Docker. - The override file keeps a containerized `dotnet watch` flow for cases where you still want Docker.
- The development container mounts the workspace into `/workspace` and stores its Couchbase Lite files under `./.docker-data/couchbase-dev` on the host. - The development container mounts the workspace into `/workspace` and stores its Couchbase Lite files under `./.docker-data/couchbase-dev` on the host.
Debugging in Docker from VS Code:
- Use the `WorkTracker: Debug in Docker` launch configuration.
- VS Code brings up the development container with `docker compose`, builds the app in `Debug`, and launches `WorkTracker.dll` under `vsdbg` inside the container.
- When the app reports that it is listening, VS Code automatically opens Microsoft Edge in browser debug mode against http://localhost:8002.
- The app remains available at http://localhost:8002 while the debugger is attached.
- Stopping the debug session runs `docker compose down` for the debug stack.
Manual development start: Manual development start:
- `docker compose up --build` - `docker compose up --build`
@ -37,4 +45,4 @@ Notes:
- The base compose file remains production-oriented; the override file is the optional containerized development layer. - The base compose file remains production-oriented; the override file is the optional containerized development layer.
- The first container build takes longer because the dev image installs the .NET debugger. - The first container build takes longer because the dev image installs the .NET debugger.
- The Dockerfile uses the .NET 9 `*-noble` images so local builds and container builds stay aligned with the SDK available in VS Code. - The Dockerfile uses the .NET 10 `*-noble` images so local builds and container builds stay aligned with the SDK available in VS Code.