Stuart
Stuart

Reputation: 496

Visual Studio 2017 Does Not Load Debug Symbols When Remote Debugging a .Net Core Console App from a Docker Windows Container

Cannot step through code when remotely debugging a .net core console app hosted on a windows docker container. Getting error "Cannot find or open the PDB file" even though the PDB is present with the DLL.

Dockerfile

FROM microsoft/windowsservercore

WORKDIR /

COPY ./tools ./

RUN dotnet-dev-win-x64.1.0.4.exe /install /quiet
RUN vs_remotetools.exe /install /quiet

EXPOSE 4022

COPY ./Clients/Client.Web.Identity.Client.MVC ./Clients/Client.Web.Identity.Client.MVC

WORKDIR ./Clients/Client.Web.Identity.Client.MVC
RUN dotnet restore Client.MVC.csproj
RUN dotnet build Client.MVC.csproj
CMD dotnet run http://*60720

Visual Studio Debug Output https://pastebin.com/D77JCtr9

Note the second line:

'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Clients\Client.Web.Identity.Client.MVC\bin\Debug\netcoreapp1.1\Client.Web.Identity.Client.Mvc.dll'. Cannot find or open the PDB file.

Container output showing MSVSMON running with Client.Web.Identity.Client.Mvc.pdb present in the dll path.

PS C:\clients\Client.Web.Identity.Client.MVC\bin\debug\netcoreapp1.1> hostname
1aaaef767980
PS C:\clients\Client.Web.Identity.Client.MVC\bin\debug\netcoreapp1.1> dir


    Directory: C:\clients\Client.Web.Identity.Client.MVC\bin\debug\netcoreapp1.1


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        7/20/2017  11:45 AM         561664 IdentityServer4.dll
-a----        7/20/2017  11:45 AM         160224 IdentityServer4.pdb
-a----        7/20/2017  11:45 AM         385545 IdentityServer4.xml
-a----        7/20/2017  11:45 AM         239282 Client.Web.Identity.Client.Mvc.deps.json
-a----        7/20/2017  11:45 AM          31744 Client.Web.Identity.Client.Mvc.dll
-a----        7/20/2017  11:45 AM           5544 Client.Web.Identity.Client.Mvc.pdb
-a----        7/20/2017  11:47 AM            133 Client.Web.Identity.Client.Mvc.runtimeconfig.dev.json
-a----        7/20/2017  11:47 AM            192 Client.Web.Identity.Client.Mvc.runtimeconfig.json
-a----        7/20/2017  11:45 AM          13312 Client.Web.Identity.Common.dll
-a----        7/20/2017  11:45 AM           3812 Client.Web.Identity.Common.pdb

PS C:\clients\Client.Web.Identity.Client.MVC\bin\debug\netcoreapp1.1> get-process

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
     90       5      968       4612       0.77   1600   1 CExecSvc
     42       3     1556       2752       0.05   1880   1 cmd
    209      11     1868       4412       1.36     68   1 csrss
    476     340    50400      40372       1.84    876   1 dotnet
    475      44    27516      47552       1.67   2044   1 dotnet
      0       0        0          4                 0   0 Idle
    735      20     4388      12764       1.91    644   1 lsass
    188      12     2276       9200       0.31    376   1 msdtc
    174      12     1948       8748       0.56   1100   1 msvsmon
    690      33    16612      39668       7.36   2160   1 msvsmon
    113       9     1360       6964       0.06   2484   1 msvsmon
    128      10     1320       6724       0.05   2604   1 msvsmon
   1227      50   102760     119608      14.39   1420   1 powershell
    178       8     1840       5796       1.36    536   1 services
     48       2      344       1156       8.45    988   0 smss
    352      14    17816      25500       7.19   2316   1 StandardCollector.Service
    283      12     2384       9084       0.75   1052   1 svchost
    253      13     2000       6876       0.84   1088   1 svchost
    271      13     2508      10460       0.72   1196   1 svchost
    288      14     5164      10636       2.50   1212   1 svchost
    849      32    10992      29032       8.89   1256   1 svchost
    188      16     3124      10104       0.88   1268   1 svchost
    390      31     5540      15760       1.97   1388   1 svchost
     89       6     1044       5344       0.13   1500   1 svchost
    354      18     4676      14180       1.83   1512   1 svchost
   3352       0      128        136      46.97      4   0 System
     91       8      908       5156       0.45    316   1 wininit

Upvotes: 5

Views: 4336

Answers (1)

Gregg Miskelly
Gregg Miskelly

Reputation: 311

Visual Studio will normally load the PDB files on the IDE side rather than in the container. So the easiest way to solve this is to build your project on the Windows side and then PDBs will automatically load. Alternatively you can build your PDBs to a folder which is mapped to the host drive, and add that folder to your symbol search list in Tools->Options->Debugger->Symbols.

Upvotes: 1

Related Questions