-
Notifications
You must be signed in to change notification settings - Fork 105
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
Support for launchSettings.json related options in DAP launch request #163
Comments
Note, https://code.visualstudio.com/docs/csharp/debugger-settings#_launchsettingsjson-support is about VSCode IDE configuration for setup debug session, not about debugger configuration itself. VSCode IDE just provide envs and form proper launch command by this configs and send it to debugger by protocol https://microsoft.github.io/debug-adapter-protocol/specification. |
Ideally the debugger should support it around here: netcoredbg/src/protocols/vscodeprotocol.cpp Lines 565 to 590 in 27606c3
By reading the contents of launchSettings.json and passing on the args and env. The configuration I've linked really is about the configuration of the debugger itself. The DAP specification says that in the launch request "additional attributes are implementation specific", and these are the implementation specific attributes that the Microsoft debugger uses. In fact, as far as I can tell, all of the attributes in launch.json are sent directly to the debugger in the request. |
My point was about - are your sure this is DAP related, but not IDE side related? Are you sure, that VSCode IDE form launch request with additional attributes? Could you please provide VSCode IDE <-> VSCode debugger protocol log with this feature enabled? |
You should be able to enable protocol logging in launch.json with:
for example: #155 (comment) |
So, this was quite interesting. I have a launch configuration like this: launch.json
And by enabling DAP message logging in settings, vsdbg prints this launch request: Launch request
The args from launchSettings.json are in there, but they are sort of weirdly at the end. Also So it looks like vsdbg is lying. I've confirmed this by patching the vscode C# extension to launch the debugger behind a "tee" style program, so that I can log the actual requests that were sent. And there is no args there. (And I'm quite sure this launchSettings option is supposed to be handled by the debugger. I couldn't find anything in the vscode extension that would parse the file. I also don't think it's actually possible for the extension to mess with the launch settings like that. |
I think I've figured out what's going on. The args parameter from launchSettings is actually added by vsdbg-ui.exe, which then presumably relays everything to vsdbg.exe. |
Hey @viewizard, what's your final verdict on this, would you accept a PR for this feature to be compatible with how vsdbg does this? Or should I try to get it supported in the vscode extension? |
@DRKV333 support of custom Not sure which approach is better and whether there're any other issues, so this needs further investigation. We won't work on this feature ourselves, but contributions are welcome. If you are interested in implementing this feature using first or second approach, please open PR in netcoredbg. Thanks for your interest in this project. |
There were some other similar issues about this this topic, but I feel like those were entirely clear about the situation.
The Microsoft .NET debugger supports reading some debug settings from a launchSettings.json file. Specifically application URL, command line arguments and environment variables. This behavior of the DAP launch request configuration is documented here: https://code.visualstudio.com/docs/csharp/debugger-settings#_launchsettingsjson-support
It would be nice to also have support for this in netcoredbg. This feature exists in vscode to provide interoperability with Visual Studio, which reads this same file. The
dotnet
command line tool also supports launchSettings. I would also personally like to use launchSettings to keep things like command line arguments out of my main launch.json, since I don't want to check them in to source control.The launch configuration contains two properties to control the launchSettings usage,
launchSettingsFilePath
andlaunchSettingsProfile
. As far as I can tell, these are currently ignored by netcoredbg.launchSettingsFilePath
determines where the json is, but defaults to{cwd}/Properties/launchSettings.json
.launchSettingsProfile
determines which section from the json file should be used, and defaults to the first one with"commandName": "Project"
. This way the launchSettings file usage is enabled by default, so implementing this exact mechanism here would also unfortunately be a behavioral change.The text was updated successfully, but these errors were encountered: