4

I was successfully able to dockerize my webapplication. Unfortunately Debugging only works partially within the docker container. All the code that is located in the startup project is debuggable, but the assemblies that are being loaded at runtime don't work.

I am aware that .pdb files need to be loaded for debugging to work. I was able to check the loaded symbols in the output and to no surprise when I am starting it with windows the symbols can be loaded, but when I start through my docker compose only the symbols from my startup project and the projects directly referenced can be loaded.

The location of dll and pdb

  • Plugins/bin/<PluginName>.dll
  • Plugins/<PluginName>/<PluginName>.pdb

Any Idea what could be causing this behaviour?

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["Presentation/Nop.Web/Nop.Web.csproj", "Presentation/Nop.Web/"]
COPY ["Libraries/Nop.Services/Nop.Services.csproj", "Libraries/Nop.Services/"]
COPY ["Libraries/Nop.Core/Nop.Core.csproj", "Libraries/Nop.Core/"]
COPY ["Libraries/Nop.Data/Nop.Data.csproj", "Libraries/Nop.Data/"]
COPY ["Presentation/Nop.Web.Framework/Nop.Web.Framework.csproj", "Presentation/Nop.Web.Framework/"]
RUN dotnet restore "Presentation/Nop.Web/Nop.Web.csproj"
COPY . .
WORKDIR "/src/Presentation/Nop.Web"
RUN dotnet build "Nop.Web.csproj" -c Debug -o /app/build


FROM build AS publish
RUN dotnet publish "Nop.Web.csproj" -c Debug -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Nop.Web.dll"]

Note the my plugin is built outside the docker container with visual studio. and the output is located inside the project Nop.Web

LuSt
  • 113
  • 2
  • 10
  • Have you examined your container to see whether it actually contains the PDBs? What does your Dockerfile look like? – Matt Thalman Apr 16 '21 at 20:53
  • Yes the pdb files exist inside the docker container aswell. They are located at the locations stated above. I'll add the dockerfile. – LuSt Apr 17 '21 at 10:50
  • Are you attaching to the container process for debugging or are you debugging another way? – Chris Danna Jun 17 '22 at 15:30
  • I have this same problem when debugging a docker-compose project. My symbols are not loaded from the devops symbol server. However, if I run the actual asp.net core project explicitly (not via compose), the symbols are loaded fine. I'm on VS 2022 and up to date. It's frustrating. – Seth Flowers Oct 05 '22 at 18:18
  • Did you ever find a solution to this? Having the same issue running my project In Visual Studio 2022 and the symbols don't get loaded when running using Docker Compose. – Darren Feb 27 '23 at 21:36

0 Answers0