Debugging .NET Core Applications in Visual Studio Code
I've been using Visual Studio Code to develop my new .NET Core apps, and I've been running into a head-scratching issue when trying to debug my code.
When setting a breakpoint and running the application, VSCode would tell me that it could not find my symbol files (PDB files). So the application ran fine, but I couldn't debug my code, at all..
I manually checked the locations of the PDB files and they where all there. For the life of me, I couldn't understand what I was doing wrong.
This problem occurred every time, even with a simple .NET Core app that was created with dotnet new.
I searched the web for hours and hours, and apparently there is a very simple solution.
.NET Core introduces a new symbol file format called portable PDBs. Unlike traditional PDBs which are Windows-only, portable PDBs can be created and read on all platforms. The new .NET Core debugger for Visual Studio Code only supports this new portable format.
So all you have to do is navigate to the project.json file and add "debugType": "portable" to 'buildOptions'.
Once I added that single configuration option I no longer received warnings and my breakpoints were hit wen running my .NET Core app in Visual Studio Code.
Enjoy!