VS2022远程调试Ubuntu上的.net 6程序,无法打断点。

宾江 莫 0 信誉分
2025-05-23T01:56:59.3+00:00

开发机是Windows,VS2022最新版,使用.net 6开发的控制台程序,以调试模式发布程序,包含有pdb文件,复制到Ubuntu Server 22.04.5 LTS上运行,

配置了Ubuntu上的调试器和SSH,可以在调试的附加进程里附加上被调试的程序了。

但无法打上断点。

VS2022的输出窗口里有这样典型的内容:

1> DebugAdapterHost version: 17.14.10225.1 commit:516899213e8aa62870424ff71a4e2ac4fceb7cba

1> State: Unset => Initializing

1> Sending VS event: IDebugEngineCreateEvent2 (fe5b734c-759d-4e59-ab04-f103343bdd06)

1> Sending VS event: IDebugProgramCreateEvent2 (96cd11ee-ecd4-4e89-957e-b5d496fc4139)

1> Determining user folder on remote system...

1> Checking for existing installation of debugging tools...

1> Downloading debugger launcher...

1> Creating debugger installation folder: /root/.vs-debugger

1> Creating directory '/root/.vs-debugger'

1> Copying debugger launcher to /root/.vs-debugger/GetVsDbg.sh

1> Copying file: 'C:\Users\mobin\AppData\Local\Temp\tmp6FDF.tmp' -> '/root/.vs-debugger/GetVsDbg.sh'

1> Ensuring script exists after copying...

1> Executing command '[ -f "/root/.vs-debugger/GetVsDbg.sh" ]' with arguments ''

1> Command exited with code '0'

1> Downloading debugger components...

1> Executing command '/bin/sh' with arguments '"/root/.vs-debugger/GetVsDbg.sh" -v vs2022 -u -l "/root/.vs-debugger/vs2022" -a "/root/.vs-debugger/GetVsDbg.sh" -o'

1> Command exited with code '0'

1> Output: Info: Last installed version of vsdbg is '17.13.20213.2'

Info: VsDbg is up-to-date

Info: Using vsdbg version '17.13.20213.2'

Using arguments

Version                    : 'vs2022'

Location                   : '/root/.vs-debugger/vs2022'

SkipDownloads              : 'true'

LaunchVsDbgAfter           : 'false'

RemoveExistingOnUpgrade    : 'true'

OfflineMode                : 'true'

Info: Skipping downloads

1> Executing command '[ -f "/root/.vs-debugger/GetVsDbg.sh" ]' with arguments ''

1> Command exited with code '0'

1> Launching remote debugger...

1> Starting '/bin/sh' with arguments '"/root/.vs-debugger/GetVsDbg.sh" -v vs2022 -u -l "/root/.vs-debugger/vs2022" -d vscode -a "/remote_debugger"'

1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"coreclr","locale":"zh-CN","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsJMCWarningRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true},"seq":1}

1> WARNING: Request 'initialize-1' has not received a response within 1000 ms!

看起来像是调试器没有完成初始化通讯,但这个细节没有找到资料可以支持排障的。

看看高人们有啥建议?

C#
C#
一种面向对象的类型安全的编程语言,它起源于 C 语言系列,包括对面向组件的编程的支持。
224 个问题
0 个注释 无注释
{count} 票

你的答案

问题作者可以将答案标记为“接受的答案”,这有助于用户了解已解决作者问题的答案。