Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netcoredbg: path value for setBreakpoints request on Windows #1073

Closed
axelhj opened this issue Oct 27, 2023 · 3 comments
Closed

netcoredbg: path value for setBreakpoints request on Windows #1073

axelhj opened this issue Oct 27, 2023 · 3 comments

Comments

@axelhj
Copy link

axelhj commented Oct 27, 2023

Problem Statement

Hi!

I have been having some issues when configuring the Samsung netcoredbg through this plugin (master branch, hash 79dbc70) with Nvim 0.9.2. I found issue #939 which appears to be the same issue, however that one is closed.

The issue is quite simple, after setting up nvim-dapui and nvim-dap, starting a debug-session and placing a breakpoint, it is immediately rejected as soon as the debug session is started, or immediately if the debugsession is already active.

I enabled tracing and inspected the pdb file from my dotnet 6.0 application bin-directory in HxD and found that all file references were including filenames only, not full filenames joined with a path. I was struggling with this for quite a while but decided to see what happens if the setBreakpoints payload.source.path used different case, or formatting to match this better.

Eventually I came up with a workaround where my breakpoints were finally successfully placed & hit; I changed the lua/dap/session.lua file around line 862 to read as

          path = vim.fn.fnamemodify(path, ':t');

rather than the original

          path = path;

which of course this is only just a hack and not an ideal solution to my problem since I and many others use other debuggers with nvim (thanks to this project which I find to be really great) and simply changing the protocol implementation at session.lua will not work - every other dap configuration would obviously break from this.

Possible Solutions

Might it be possible to add a configuration option in nvim-dap to handle this case somehow? My csproj file is quite usual as far as C# project setups go. Not sure if the issue lies with the netcoredbg dap implementation or the .Net Core CLI compiler invocation settings.

Considered Alternatives

I am looking for a reasonable means of configuring this - I realize it might be better to figure out why the breakpoint path is not matching with what appears to be the default .Net core project settings.

Appreciate any feedback & suggestions or dap protocol monkey patch options in this project. I saw a different ticket where a similar suggestion was raised but considered not really desired.

@axelhj
Copy link
Author

axelhj commented Oct 28, 2023

I made a repro in my netcoredbg issue here, including nvim-dap logs and a repro project. I am still not sure if there is a bug/DAP noncompliance in this project, the debugger or the dotnet cli/C# compiler.

Update: netcoredbg accepts backslashes in the setBreakpoints DAP-request, while nvim-dap sends forward slashes. Is this configurable? I checked the Microsoft DAP specification but it does not say much about whether this value should use platform specific path separators.

I used set noshellslash my breakpoints can now be set & hit reliably. This issue can be closed, but maybe this could be mentioned in the installation guide.

@axelhj axelhj closed this as completed Oct 28, 2023
@mfussenegger
Copy link
Owner

This issue can be closed, but maybe this could be mentioned in the installation guide.

The wiki is editable by anyone. Could you make these changes?

@axelhj
Copy link
Author

axelhj commented Oct 29, 2023

Sure, I didn't realize I can do that myself. Added a troubleshooting step of sorts. It works great now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants