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

VSCode protocol "launch" command "sourceFileMap" option support. #78

Open
C-SELLERS opened this issue Dec 11, 2021 · 4 comments
Open

VSCode protocol "launch" command "sourceFileMap" option support. #78

C-SELLERS opened this issue Dec 11, 2021 · 4 comments

Comments

@C-SELLERS
Copy link

Question for you guys,

Does netcoredbg support source file mapping through the VSCodeProtocol? Just looking through vscodeprotocol.cpp, I don't believe it does but I could be missing something.

Thank you!

@viewizard
Copy link
Member

We don't support this for sure. Could you please share more info about source file mapping through the VSCode protocol? Do you mean "Source Request" https://microsoft.github.io/debug-adapter-protocol/specification?

@C-SELLERS
Copy link
Author

Apologies, turns out its not something that the VSCode protocol manages, but rather is a feature of the debugger. I believe debugger engines like vsdbg manage this sort of mapping internally.

When testing with vsdbg it comes through with the "attach" or "launch" command in the argument list like so
"sourceFileMap":{"/pathDuringBuild":"/currentPath"}

Then presumably the debugger behind the scenes will replace any instance of pathDuringBuild with currentPath. This way I can continue to debug a file that has changed locations since the building of the dll & pdb.

Curious what it would take to add that flexibility to netcoredbg 🤔

@viewizard
Copy link
Member

viewizard commented Dec 13, 2021

I see, you mean https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#source-file-map, we already support "justMyCode" and "enableStepFiltering" launch options, so, add more launch options possible. Unfortunately, we don't have time right now, but I added this to feature requests list.

@viewizard viewizard changed the title SourceFileMapping Support VSCode protocol "launch" command "sourceFileMap" option support. Dec 13, 2021
@C-SELLERS
Copy link
Author

Yes!

That's great, I appreciate it.

In the meantime I found a less flexible work around that can be set during build. By using property PathMap in your csproj or as a build property from the cli you can effectively map an alternative directory as the source directory.

EX. I am building in /Builder/Project/ , but will be running and debugging the copied source in /Project/.

  1. Adding <PathMap>/Builder/Project/=/Project/</PathMap> to the csproj property group
  2. dotnet build -p:pathmap=/Builder/Project/=/Project/

Both of these will map the file locations in the pdbs to /Project/ allowing you to debug a source in a different directory than the original 👍🏽

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

No branches or pull requests

2 participants