Skip to content

Breakpoints not working on windows #1551

@DePaWSiT

Description

@DePaWSiT

Debug adapter definition and debug configuration

OS: windows 10

default config for Dotnet so that would be

dap.adapters.coreclr = {
  type = 'executable',
  command = '/path/to/dotnet/netcoredbg/netcoredbg',
  args = {'--interpreter=vscode'}
}
dap.configurations.cs = {
  {
    type = "coreclr",
    name = "launch - netcoredbg",
    request = "launch",
    program = function()
        return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
    end,
  },
}

running :set noshellslash? returns noshellslash so i guess that would be correct

I did get it to work tho.
By modifying dap/session.lua
in the function Session:set_breakpoints

local path = api.nvim_buf_get_name(bufnr)
---@type dap.SetBreakpointsArguments
local payload = {
  source = {
    path = path;
    name = vim.fn.fnamemodify(path, ':t')
  };

And changing it to this

local path = api.nvim_buf_get_name(bufnr)
      ---@type dap.SetBreakpointsArguments
      local payload = {
        source = {
          path = string.gsub(path, "/", "\\");
          name = vim.fn.fnamemodify(path, ':t')
        };

Maybe this could be of any help

local separator = package.config:sub(1, 1)
if separator ~= "/" then
  --replace /
end

Could probably do this myself but i'm not really familiar with the ways of lua or the vim api and i'd rather not break stuff other people actually use. I'll try but with this the issue is atleast made...

Debug adapter version

3.1.2-1

Steps to Reproduce

  1. Create a (console) project
  2. Have a statement (Console.WriteLine() works good enough)
  3. Set a breakpoint on the statement
  4. Build project
  5. Run dap with the generated dll

Expected Result

Freezes at the breakpoint

Actual Result

Goes past the breakpoint

dap.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions