This code demonstrates the various ways to debug a .NET application in VS Code.
-
Open
Program.csand set a break point on theConsole.WriteLine("Hello, World!"); -
On the Debug tab of your VS Code, run the
.NET Core Launchconfiguration. -
Your
Program.csshould pause on your breakpoint and await your instructions.
-
Open
Program.csand set a break point on theConsole.WriteLine("Hello, World!"); -
Bring up the docker container with
docker compose up
-
On the Debug tab of your VS Code, run the
.NET Core Docker Attachconfiguration. -
Pick the process that matches the
/app/bin/Debug/net9.0/dotnet-testappbinary. -
Your
Program.csshould pause on your breakpoint and await your instructions.