I have a great post here that details how to install the Visual Studio debugger on a Raspberry Pi. That, together with the Dot Net Core libraries, gives you everything you need to remote debug code running on the Pi, but how do you attach it to the Pi from Visual Studio?
You connect using the normal ‘Attach to Process’ option in the Debug menu.
There are several options in the connection type drop-down. With the Raspberry Pi, you select SSH. I wasn’t aware that you could debug over SSH, but it is cool that you can!
Having selected SSH, you change the Connection Target to the credentials you want to use to connect to the Pi. As I typically create just one account for admin on the Pi, I enter admin@ipaddress.
After a few seconds, Visual Studio connects to the Pi and lists the running processes; you select the process you want to connect to and click the Attach button at the bottom of the screen, and it connects.
It works in exactly the same way you debug local applications. You can set breakpoints, view/amend variables, run commands in the Immediate window, and do everything else you usually do.