0

I saw the documentation, but it does not show how to start the process from Visual Studio. The document says that I should manually copy the built binary to the Linux machine, run the binary on the Linux machine, and then attach VS to the process.

But this would only work if the application is in some sort of a loop, like a GUI application or web server, or in a while loop as the documentation's example below. But what if my console application is not in a loop? If I manually start it on the Linux machine, it immediately finishes its work and exits. How can I set a breakpoint at the first line in Visual Studio, and then start the process remotely from Visual Studio?

enter image description here

Damn Vegetables
  • 11,484
  • 13
  • 80
  • 135
  • Maybe [this link](https://stackoverflow.com/questions/23108728/linux-net-remote-debugging-from-visual-studio) will help you handle the issue. – Mr Qian Oct 26 '20 at 09:16
  • @PerryQian-MSFT Well, the linked page did not have a solution for this. In the end, I just added `Console.ReadKey()` at the beginning of my programme, set a breakpoint after that line, executed the binary on Linux, and then pressed a key on Linux. It worked, but this is really inconvenient. – Damn Vegetables Oct 27 '20 at 09:41
  • Since you have a workaround about the issue, I suggest you could add your answer here rather than a comment and then mark your own answer. And it could help other community members handle and search similar issues. Thanks :) – Mr Qian Nov 09 '20 at 01:46
  • @PerryQian-MSFT Actually, I have found a better way, using Visual Studio Code's remote SSH debugging. Unlike VS, the project source itself is on the remote computer, and building is done on the remote, so there is no need to keep copying the built files, and I could start the programme from VS Code, so setting a break point was easy. I guess for a .net Core console projects VS Code is a better tool for this. – Damn Vegetables Nov 09 '20 at 05:17

0 Answers0