How can I debug a class library in VS Code?
I have an ASP.NET Core project and a class library that is in a separate solution. The class library is going to be a nuget package.
I've added a project reference to the class library in my ASP.NET Core project and debug.
In the class library project, I've tried attaching the debugger to the same process ID that the ASP.NET core project is using but it fails with:
Failed to attach to process: Unknown Error: 0x80131c08
You'd need to publish a symbols package, and then go into Visual Studio's settings, then Debugging and Geneal under that. In the list of preferences is one called "Just My Code". That will need to be unchecked.
That said, the better option here is to not debug from another solution. In your solution with the class library, create a test project, and then add tests for all the library's functionality. When running the tests, you can debug, instantly modify your class library code, and keep rolling. Only once you're sure your library works correctly should you then include it in another project and start development on that.
Additionally, in the very early stages of development, it's usually a better idea to keep everything in one solution. Later, you can always break things out into multiple solutions, enable NuGet package creation, etc., but during initial development, having all this eventual setup only serves to cause friction, slowing you down.
User contributions licensed under CC BY-SA 3.0