You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to start a controller process by running dotnet run and then connect to the process and set a breakpoint.
In my case I got to the point I can attach to the process from the list of running processes but when I set a breakpoint it changes from B to R (not resolved).
Not sure what I am missing, I checked that all the debug symbols are there etc.
Also I connect to the right process since if I press the "stop" button in dap UI it kills the right process.
Here is my dap config code for c#:
dap.adapters.netcoredbg = {
type = "executable",
command = "/usr/local/bin/netcoredbg/netcoredbg", -- Update this path to your netcoredbg executable
args = { "--interpreter=vscode" },
}
-- Define the configuration for C# debugging
dap.configurations.cs = {
{
-- Launch configuration
justMyCode = false,
type = "netcoredbg",
name = "launch - netcoredbg",
request = "launch",
program = function()
local last_path_file = get_last_path_file()
local last_path = ""
if vim.fn.filereadable(last_path_file) == 1 then
last_path = vim.fn.readfile(last_path_file)[1] or ""
end
local file_path = vim.fn.input("Enter path to .exe or .dll: ", last_path)
if file_path and file_path ~= "" then
vim.fn.writefile({ file_path }, last_path_file)
return file_path
else
error("Invalid path. Debugging aborted.")
end
end,
},
{
-- Attach configuration
type = "netcoredbg",
name = "attach - netcoredbg",
request = "attach",
processId = function()
local pids = vim.fn.systemlist("pgrep -f 'dotnet run'")
local choices = {}
for _, pid in ipairs(pids) do
pid = vim.trim(pid)
if pid ~= "" then
local cmd = vim.fn.system(string.format("ps -p %s -o args=", pid)):gsub("\n", "")
local cwd = vim.fn.system(string.format("pwdx %s", pid)):match(": (.+)\n")
if cwd then
table.insert(choices, {
pid = pid,
label = string.format("%s - %s [%s]", pid, cmd, cwd),
})
end
end
end
return coroutine.create(function(coro)
vim.ui.select(choices, {
prompt = "Select dotnet process to attach to:",
format_item = function(item)
return item.label
end,
}, function(choice)
if choice then
coroutine.resume(coro, tonumber(choice.pid))
else
error("No process selected")
end
end)
end)
end,
},
}
Wonder if I can debug it further or if there is some log file I can check.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to be able to start a controller process by running
dotnet run
and then connect to the process and set a breakpoint.In my case I got to the point I can attach to the process from the list of running processes but when I set a breakpoint it changes from B to R (not resolved).
Not sure what I am missing, I checked that all the debug symbols are there etc.
Also I connect to the right process since if I press the "stop" button in dap UI it kills the right process.
Here is my dap config code for c#:
Wonder if I can debug it further or if there is some log file I can check.
Beta Was this translation helpful? Give feedback.
All reactions