最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

visual studio debugging - How to debug single-file .net executable on Linux - Stack Overflow

programmeradmin1浏览0评论

I'm building a Linux application and debugging it by publishing self-contained executable to the remote target host and attaching Visual Studio debugger.

When I publish it as a single file with this command

dotnet publish  --configuration Debug --runtime linux-x64 --output ./publish --self-contained -p:PublishSingleFile=true 

the debugger fails to connect:

One or more errors occurred.
Failed to attach to process: Failed to load the .NET Debugging Services.

The application can be debugged when it's not self-contained. Is single file debugging possible at all?

I'm building a Linux application and debugging it by publishing self-contained executable to the remote target host and attaching Visual Studio debugger.

When I publish it as a single file with this command

dotnet publish  --configuration Debug --runtime linux-x64 --output ./publish --self-contained -p:PublishSingleFile=true 

the debugger fails to connect:

One or more errors occurred.
Failed to attach to process: Failed to load the .NET Debugging Services.

The application can be debugged when it's not self-contained. Is single file debugging possible at all?

Share edited Mar 18 at 11:06 jackhab asked Mar 4 at 8:42 jackhabjackhab 17.8k39 gold badges108 silver badges143 bronze badges 9
  • Are you attaching to a process on a remote computer(Linux)? – Dou Xu-MSFT Commented Mar 5 at 8:18
  • @DouXu-MSFT Yes – jackhab Commented Mar 5 at 14:53
  • @jackhab not with managed code debugger. You can change the code type to be Native but not sure how good the experience would be – Paweł Łukasik Commented Mar 5 at 17:06
  • 1 Yes, I'm connecting via SSH and I'm copying all the content of publish folder. Attaching debugger only fails when I publish as single file. – jackhab Commented Mar 15 at 12:02
  • 1 @BDisp Thanks! Do you mind posting it as an answer so that I can tick it as accepted? – jackhab Commented Mar 23 at 20:12
 |  Show 4 more comments

1 Answer 1

Reset to default 0

No, debugging single file is not supported. See https://github/dotnet/vscode-csharp/wiki/Troubleshoot-loading-the-.NET-Debug-Services.

发布评论

评论列表(0)

  1. 暂无评论