Skip to content

F# computation expression breakpoints don't fire in DAP mode #9

@bryancostanich

Description

@bryancostanich

Problem

Line breakpoints inside Expecto test "name" { ... } computation expression blocks never fire when debugging via DAP (Debug Adapter Protocol). This affects both Microsoft's vsdbg and Samsung's netcoredbg.

Breakpoints show as verified (solid red in VS Code) but the debugger never stops. Breakpoints in regular F# functions and Program.fs work fine — only CE bodies are affected.

Root cause

The F# compiler transforms CE bodies into closure classes (e.g., simTests@20-3.Invoke()). The DAP setBreakpoints protocol can't resolve source lines to the generated IL sequence points in these closure classes.

What works

  • netcoredbg CLI mode: break SimTests.fs:22 works when set after modules are loaded (two-stage approach). The CLI break command uses a different internal resolution path than DAP setBreakpoints.
  • Function breakpoints: Auto function breakpoint on Verifrog.Sim.Sim.ReadOrFail fires on virtually any test that reads a signal.
  • Non-CE code: Breakpoints in regular F# functions, Program.fs, etc. work fine with both debuggers.

What doesn't work

  • justMyCode: false — no effect
  • Re-sending setBreakpoints after entry stop — returns verified: true but still doesn't fire
  • Toggling breakpoints off/on — no effect
  • stopAtEntry + re-resolve — no effect

Possible fix paths

  1. Custom DAP proxy — Translate incoming setBreakpoints requests into netcoredbg CLI-style break commands after module load. This would work around the DAP protocol limitation without waiting for upstream fixes.
  2. Upstream netcoredbg fix — File issue with Samsung/netcoredbg for F# CE breakpoint support in DAP mode.
  3. Upstream vsdbg fix — File issue with Microsoft, though vsdbg is closed-source and less likely to get F#-specific fixes.

Context

Discovered during Track 06 (debug integration). Full investigation notes in conductor/projects/v1_release/tracks/06_debug_integration/plan.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions