debugee:
static void Main(string[] args) {
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(@"C:\tmp\cs.log", true, System.Text.Encoding.UTF8)) {
for (int i = 0; i < args.Length; i++) {
sw.WriteLine($"args[{i}]: [{args[i]}]");
}
}
dap log:
{"adapter": "netcoredbg", "configuration": {"type": "coreclr", "request": "launch", "program": "dotnet.exe", "args": ["bin\\Debug\\net8.0-windows\\test.dll", "D:\\path\\to\\dir\\"], "cwd": "K:\\PROJECTS\\test", "stopAtEntry": true, "console": "internalConsole"}}
cs.log:
args[0]: [D:\\path\\to\\dir\]
Please note the missing slash at the end and the duplication of other slashes.
It seems that this function does not take into account Windows specifics:
|
static std::string EscapeShellArg(const std::string &arg) |
|
{ |
|
std::string s(arg); |
|
|
|
for (std::string::size_type i = 0; i < s.size(); ++i) |
|
{ |
|
std::string::size_type count = 0; |
|
char c = s.at(i); |
|
switch (c) |
|
{ |
|
case '\"': count = 1; s.insert(i, count, '\\'); s[i + count] = '\"'; break; |
|
case '\\': count = 1; s.insert(i, count, '\\'); s[i + count] = '\\'; break; |
|
} |
|
i += count; |
|
} |
|
|
|
return s; |
|
} |
debugee:
dap log:
{"adapter": "netcoredbg", "configuration": {"type": "coreclr", "request": "launch", "program": "dotnet.exe", "args": ["bin\\Debug\\net8.0-windows\\test.dll", "D:\\path\\to\\dir\\"], "cwd": "K:\\PROJECTS\\test", "stopAtEntry": true, "console": "internalConsole"}}cs.log:
Please note the missing slash at the end and the duplication of other slashes.
It seems that this function does not take into account Windows specifics:
netcoredbg/src/debugger/manageddebugger.cpp
Lines 600 to 617 in 8b8b222