I have several ASP.NET Core (6.0) WebApi projects that are dockerized using docker-compose. For local development, I use a docker-compose file which references Dockerfiles that build / publish the projects in Debug mode. Then in order to debug, I use the 'Docker .NET Core Attach (Preview)' launch configuration and select the corresponding docker container, which then prompts me about copying the .NET Core debugger into the container.
Until recently, this always worked and I could debug inside the container. Now suddenly, after being prompted and trying to copy the debugger into the container, I always get the following error:
Starting: "docker" exec -i web_roomservice /remote_debugger/vsdbg --interpreter=vscode
Error from pipe program 'docker': FATAL ERROR: Failed to initialize dispatcher with error 80131534
The pipe program 'docker' exited unexpectedly with code 255.
I tried re-installing the Docker Engine docker-compose (with the latest version), re-installing VS Code the 'Docker' and 'C#' extensions, migrating from ASP.NET Core 5.0 to 6.0 (since 5.0 is not supported anymore) and obviously rebuilding my images multiple times, but nothing seems to work and I can't find anything online. Any help with this would be greatly appreciated, since as of now I can't debug which sucks.
These are my docker-compose, Debug-Dockerfile and launch config (for one project / service):
version: "3.7"
services:
roomservice:
image: web_roomservice
container_name: web_roomservice
build:
context: ./
dockerfile: Dockerfile.RoomService.Debug
expose:
- "5011"
volumes:
- /etc/localtime:/etc/localtime:ro
environment:
- ASPNETCORE_ENVIRONMENT=Development
user: "root:root"
logging:
driver: "json-file"
options:
max-size: "5m"
(There's more but I only included the section with this one service)
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
#EXPOSE 5011
ENV ASPNETCORE_URLS=http:// :5011
# Install netpbm which is used for .pgm to .png file conversion for map images
RUN apt-get -y update --silent
RUN apt-get -y install netpbm --silent
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-dotnet-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["RoomService/RoomService.csproj", "./RoomService/"]
COPY ["EventBusRabbitMQ/EventBusRabbitMQ.csproj", "./EventBusRabbitMQ/"]
COPY ["Common/Common.csproj", "./Common/"]
RUN dotnet restore "RoomService/RoomService.csproj"
COPY RoomService ./RoomService
COPY EventBusRabbitMQ ./EventBusRabbitMQ
COPY Common ./Common
WORKDIR "/src/RoomService"
RUN dotnet build "RoomService.csproj" -c Debug -o /app/build
FROM build AS publish
RUN dotnet publish "RoomService.csproj" -c Debug -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "RoomService.dll"]
(This Dockerfile is placed in the workspace folder (parent of the actual RoomService project folder) in order to include the Common project)
{
"version": "0.2.0",
"configurations": [
{
"name": "Docker .NET Core Attach (Preview)",
"type": "docker",
"request": "attach",
"platform": "netCore",
"sourceFileMap": {
"/src/RoomService": "${workspaceFolder}"
}
}
]
}
(This launch configuration is placed in the actual RoomService project folder's .vscode subfolder)
CodePudding user response:
Had the same problem today. Try deleting the ~/vsdbg directory, if you are on MacOS.
CodePudding user response:
David is right. I was having the same issue. I am running WSL2 (Ubuntu) and when I deleted the ~/.vsdbg
directory that fixed the issue for me.