Closed Werewolfkiss closed 2 months ago
The only workaround I can think of is to use the "Compose Up/Down/Restart" options under the Docker Compose project context menu in Solution Explorer, then in the container tools window, you can attach again to the"dotnet" process within the container. Can you share a bit more of the scenario and why stopping and starting debugging via "F5" in Visual Studio isn't working for you?
For any tooling suggestions like handling restarts and re-attaching,etc.., please submit something at https://developercommunity.visualstudio.com/VisualStudio/suggest so we can prioritize with other requests.
When starting a couple containers using a docker compose project I am unable to restart containers (through docker api/docker desktop/VS container window) Because the tooling overrides the normal entry point for a container if the container is restarted my dotnet application is not also started within the container.
I have tried setting up a docker-compose.vs.debug.yml file with the following content: services: MyService: entrypoint: "dotnet /app/bin/Debug/net6.0/MyService.dll && tail -f /dev/null" labels: com.microsoft.visualstudio.debuggee.program: "dotnet" com.microsoft.visualstudio.debuggee.arguments: " --help" com.microsoft.visualstudio.debuggee.workingdirectory: "/app" com.microsoft.visualstudio.debuggee.killprogram: "/bin/sh -c \"if PID=$$(pidof dotnet); then kill $$PID; fi\""
But then the debugger doesn't attach, and if I leave out the labels section I start the application twice and I get errors related to Ports being used already.
Is there a workaround that I can use, or can the tooling be made to handle restarts of containers by reattaching debuggers and restarting the applications?