netcoredbg
netcoredbg copied to clipboard
VSCode protocol "launch" command "sourceFileMap" option support.
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!
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?
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 🤔
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.
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/
.
- Adding
<PathMap>/Builder/Project/=/Project/</PathMap>
to the csproj property group -
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 👍🏽