Debugging vvvv gamma C# Projects
For CLI arguments and session files, see the vvvv-startup skill.
Context-Aware Setup Workflow
When the user asks to set up debugging, follow this workflow. Ask ALL configuration questions upfront using AskUserQuestion before generating any files. Do NOT assume defaults — always confirm with the user.
1. Detect vvvv Installation
Find vvvv.exe automatically by scanning C:\Program Files\vvvv\ for vvvv_gamma_* directories:
CODEBLOCK0
Directory name format: vvvv_gamma_MAJOR.MINOR[-BUILD-gHASH-PLATFORM]. Sort by version descending. Filter out -beta, -alpha, -rc, -test, -dev variants unless no stable version exists.
2. Scan Workspace
Detect what exists in the workspace:
- -
.csproj / .sln files (may or may not need build tasks -- see step 3) - INLINECODE10 files (candidates for
--open) - INLINECODE12 folders (common location for test patches)
- Existing
.vscode/launch.json (extend rather than overwrite) - Git submodules (especially
VL.StandardLibs — see package repos warning below) - Package names from repo folder name, main *.vl file or
.csproj <PackageId> (for --editable-packages)
3. Ask User — ALL Questions Before Generating
CRITICAL: Ask all of these questions using AskUserQuestion BEFORE generating any configuration. Use multi-question format to batch related questions. Do not generate launch.json until all answers are collected.
Question Group 1: vvvv Version & Patch
- - Which vvvv version? — Present detected versions, recommend the latest stable. Let user pick or specify a custom path.
- Which .vl patch to open? — List found
.vl files as options. If help/ folder exists, suggest those.
Question Group 2: Launch Flags
- -
--debug flag? — Enables debug symbols for breakpoints but slows patching. Ask: "Enable --debug for breakpoints? (slower startup)" Default: No for fast iteration, Yes if user explicitly wants breakpoints. --allowmultiple? — Allows launching a second vvvv instance. Ask: "Allow multiple vvvv instances? If No, launch will fail if vvvv is already running (useful to detect stale instances)." Default: No.--package-repositories? — Points vvvv to scan a folder for packages. WARNING: If the workspace contains git submodules like VL.StandardLibs/, using --package-repositories ${workspaceFolder} will cause vvvv to recompile ALL core libraries from source, taking many minutes. Ask: "Add --package-repositories? Only needed if vvvv can't find your package. WARNING: if your repo has VL.StandardLibs or other library submodules, this will trigger full recompilation." Default: No.--editable-packages? — Loads specified packages from source. Only useful with --package-repositories. Ask only if package-repositories is enabled.
Question Group 3: Build Mode
- - Source reference or DLL? — "Does your .vl document reference the .csproj directly (source reference, most common) or a pre-built DLL?" Source reference = no build task. DLL = add
preLaunchTask: "build".
4. Generate Configuration
Only after all questions are answered, generate .vscode/launch.json and optionally .vscode/tasks.json.
Always generate these configurations:
- 1. A launch config with the user's chosen flags
- An "Attach to vvvv" config for attaching to an already-running instance
Optionally generate:
- - A second launch config with
--debug if the first one doesn't have it (or vice versa) - A
tasks.json if DLL/binary build mode was selected
VS Code launch.json
Minimal Config (source reference, no extras)
The simplest possible config — just open a patch:
CODEBLOCK1
Full Config (with all optional flags)
When the user opts in to all flags:
CODEBLOCK2
DLL/Binary Reference (external build required)
Add preLaunchTask to build C# before launching vvvv:
CODEBLOCK3
Key points:
- - Omit
preLaunchTask for source references -- vvvv handles C# compilation via Roslyn - Add
preLaunchTask: "build" only for DLL/binary references or complex build scenarios - INLINECODE37 enables debug symbols (needed for breakpoints, but slows down patching)
- INLINECODE38 tells vvvv where to find your package — WARNING: will recompile any VL library submodules found in the scanned folder tree
- INLINECODE39 loads specified packages from source (glob patterns supported)
- INLINECODE40 opens the specified .vl patch on startup
- INLINECODE41 allows a second vvvv instance — omit to detect stale instances
- Use array items for args (not a single string) for readability
Attach to Running vvvv
Use attach when vvvv is already running and you want to debug without restarting:
CODEBLOCK4
VS Code tasks.json (only for DLL/binary reference setups)
Only generate tasks.json when the project requires external building (DLL references, native dependencies, Release builds). Skip this entirely for source project references where vvvv compiles C# at runtime.
Build with dotnet
CODEBLOCK5
Build with MSBuild (for .sln or projects requiring Visual Studio toolchain)
CODEBLOCK6
Prefer dotnet build unless the project requires MSBuild-specific features or a .sln with platform targets.
Visual Studio Setup
Debug via External Program
- 1. Open
.csproj in Visual Studio - Debug > Debug Properties (or Project Properties > Debug > General)
- Create a new launch profile:
-
Command: path to
vvvv.exe
-
Command line arguments:
-o YourPatch.vl (add
--debug when breakpoints are needed)
-
Working directory: project folder
- 4. Press F5 to launch with debugger attached
Attach to Process
- 1. Launch vvvv normally (add
--debug if you need breakpoints) - Debug > Attach to Process (Ctrl+Alt+P)
- Find
vvvv.exe in the process list - Select Managed (.NET Core, .NET 5+) as code type
- Click Attach
launchSettings.json (dotnet tooling)
CODEBLOCK7
Debugging Tips
- -
--debug -- forces debug symbol emission for reliable breakpoints, but adds overhead. Use in the Debug config; omit for performance/deployment testing. --stoppedonstartup -- launch paused so you can set breakpoints before any Update() runs--nocache -- if breakpoints won't bind, force recompilation from sourceDebugger.Break() -- add to C# code to programmatically trigger a breakpoint- Conditional breakpoints in Update() -- Update() runs every frame, so use hit counts or conditions
- Constructor breakpoints -- fire on each live-reload cycle too (Dispose then new Constructor)
console: "internalConsole" -- captures Console.WriteLine output in VS Code debug console- Debugger-attached behavior -- when a .NET debugger is attached, vvvv initialization runs synchronously (no async exception trapping), so startup breakpoints work reliably
Common Pitfalls
- -
--package-repositories + VL.StandardLibs submodule — If your workspace has a VL.StandardLibs/ git submodule (common in vvvv contrib repos), --package-repositories ${workspaceFolder} will cause vvvv to discover and recompile ALL standard libraries from source. This takes many minutes and is almost never what you want. Either omit --package-repositories or point it at a specific subfolder that doesn't contain library submodules. --allowmultiple hiding stale instances — Without this flag, vvvv refuses to start if another instance is running. This is useful: it tells you there's a stale vvvv process. With --allowmultiple, you might accidentally run two instances consuming double resources.--debug slowing everything — Debug symbol emission significantly slows vvvv's live compilation. Only enable when you actually need breakpoints. For quick iteration (testing UI, checking behavior), omit it.
调试 vvvv gamma C# 项目
关于 CLI 参数和会话文件,请参阅 vvvv-startup 技能。
上下文感知设置工作流程
当用户要求设置调试时,请遵循此工作流程。在生成任何文件之前,使用 AskUserQuestion 预先询问所有配置问题。不要假设默认值——始终与用户确认。
1. 检测 vvvv 安装
通过扫描 C:\Program Files\vvvv\ 中的 vvvvgamma* 目录自动查找 vvvv.exe:
bash
ls -d /c/Program Files/vvvv/vvvvgamma* 2>/dev/null | sort -r
目录名称格式:vvvvgammaMAJOR.MINOR[-BUILD-gHASH-PLATFORM]。按版本降序排序。除非没有稳定版本,否则过滤掉 -beta、-alpha、-rc、-test、-dev 变体。
2. 扫描工作区
检测工作区中存在的内容:
- - .csproj / .sln 文件(可能需要或不需要构建任务——参见步骤 3)
- .vl 文件(--open 的候选文件)
- help/ 文件夹(测试补丁的常见位置)
- 现有的 .vscode/launch.json(扩展而非覆盖)
- Git 子模块(特别是 VL.StandardLibs——参见下面的包仓库警告)
- 来自仓库文件夹名称、主 *.vl 文件或 .csproj 的包名称(用于 --editable-packages)
3. 询问用户——在生成前询问所有问题
关键:在生成任何配置之前,使用 AskUserQuestion 询问所有这些问题。 使用多问题格式批量处理相关问题。在收集所有答案之前,不要生成 launch.json。
问题组 1:vvvv 版本和补丁
- - 使用哪个 vvvv 版本? — 列出检测到的版本,推荐最新的稳定版本。让用户选择或指定自定义路径。
- 打开哪个 .vl 补丁? — 列出找到的 .vl 文件作为选项。如果存在 help/ 文件夹,建议使用这些文件。
问题组 2:启动标志
- - --debug 标志? — 启用断点的调试符号,但会减慢补丁速度。询问:启用 --debug 以支持断点?(启动较慢) 默认值:快速迭代为否,如果用户明确需要断点则为是。
- --allowmultiple? — 允许启动第二个 vvvv 实例。询问:允许多个 vvvv 实例?如果否,当 vvvv 已在运行时启动将失败(有助于检测过时实例)。 默认值:否。
- --package-repositories? — 指示 vvvv 扫描文件夹以查找包。警告:如果工作区包含像 VL.StandardLibs/ 这样的 git 子模块,使用 --package-repositories ${workspaceFolder} 将导致 vvvv 从源代码重新编译所有核心库,需要几分钟时间。 询问:添加 --package-repositories?仅在 vvvv 找不到您的包时需要。警告:如果您的仓库有 VL.StandardLibs 或其他库子模块,这将触发完全重新编译。 默认值:否。
- --editable-packages? — 从源代码加载指定的包。仅在与 --package-repositories 一起使用时有用。仅在启用包仓库时询问。
问题组 3:构建模式
- - 源代码引用还是 DLL? — 您的 .vl 文档是直接引用 .csproj(源代码引用,最常见)还是预构建的 DLL? 源代码引用 = 无需构建任务。DLL = 添加 preLaunchTask: build。
4. 生成配置
只有在所有问题都回答后,才生成 .vscode/launch.json 和可选的 .vscode/tasks.json。
始终生成这些配置:
- 1. 一个带有用户选择标志的启动配置
- 一个用于附加到已运行实例的附加到 vvvv配置
可选生成:
- - 如果第一个配置没有 --debug,则生成第二个带有 --debug 的启动配置(反之亦然)
- 如果选择了 DLL/二进制构建模式,则生成 tasks.json
VS Code launch.json
最小配置(源代码引用,无额外选项)
最简单的可能配置——只需打开一个补丁:
json
{
version: 0.2.0,
configurations: [
{
name: vvvv — MyPatch,
type: coreclr,
request: launch,
program: C:\\Program Files\\vvvv\\vvvvgamma7.1-win-x64\\vvvv.exe,
args: [
-o,
${workspaceFolder}/help/HowTo Use MyFeature.vl
],
cwd: ${workspaceFolder},
stopAtEntry: false,
console: internalConsole
},
{
name: Attach to vvvv,
type: coreclr,
request: attach,
processName: vvvv.exe
}
]
}
完整配置(包含所有可选标志)
当用户选择所有标志时:
json
{
version: 0.2.0,
configurations: [
{
name: Debug with vvvv,
type: coreclr,
request: launch,
program: C:\\Program Files\\vvvv\\vvvvgamma7.0-win-x64\\vvvv.exe,
args: [
--package-repositories,
${workspaceFolder},
--editable-packages,
VL.MyPackage*,
-o,
${workspaceFolder}/help/HowTo Use MyFeature.vl,
--debug,
--allowmultiple
],
cwd: ${workspaceFolder},
stopAtEntry: false,
console: internalConsole
},
{
name: Attach to vvvv,
type: coreclr,
request: attach,
processName: vvvv.exe
}
]
}
DLL/二进制引用(需要外部构建)
添加 preLaunchTask 以在启动 vvvv 之前构建 C#:
json
{
name: Debug with vvvv (pre-build),
type: coreclr,
request: launch,
preLaunchTask: build,
program: C:\\Program Files\\vvvv\\vvvvgamma7.0-win-x64\\vvvv.exe,
args: [
-o,
${workspaceFolder}/help/HowTo Use MyFeature.vl,
--debug
],
cwd: ${workspaceFolder},
stopAtEntry: false,
console: internalConsole
}
关键点:
- - 省略 preLaunchTask 用于源代码引用——vvvv 通过 Roslyn 处理 C# 编译
- 仅添加 preLaunchTask: build 用于 DLL/二进制引用或复杂构建场景
- --debug 启用调试符号(断点需要,但会减慢补丁速度)
- --package-repositories 告诉 vvvv 在哪里找到您的包——警告:将重新编译扫描文件夹树中找到的任何 VL 库子模块
- --editable-packages 从源代码加载指定的包(支持通配符模式)
- -o 在启动时打开指定的 .vl 补丁
- --allowmultiple 允许第二个 vvvv 实例——省略以检测过时实例
- 为 args 使用数组项(而不是单个字符串)以提高可读性
附加到正在运行的 vvvv
当 vvvv 已在运行且您想在不重启的情况下进行调试时使用附加:
json
{
name: Attach to vvvv,
type: coreclr,
request: attach,
processName: vvvv.exe
}
VS Code tasks.json(仅用于 DLL/二进制引用设置)
仅在项目需要外部构建(DLL 引用、本机依赖、发布构建)时生成 tasks.json。对于 vvvv 在运行时编译 C# 的源代码项目引用,完全跳过此步骤。
使用 dotnet 构建
json
{
version: 2.0.0,
tasks: [
{
label: build,
command: dotnet,
type: process,
args: [build, ${workspaceFolder}/src/MyProject.csproj, -