I ran into an obscure problem debugging some Net Standard 2.0 class libraries the other day. This was in the context of a solution that contained both Net Standard and Net Traditional projects.
I’d set some breakpoints in one of the Net Standard libraries, and launched a Net Traditional app in the debugger. Imagine my surprise when the breakpoints never got hit!
So I started over, and stepped through the Net Traditional app to a point where it called one of the Net Standard methods, and clicked F11. Only to be confronted with a white warning screen from Visual Studio, telling me it couldn’t find the PDB files it needed to walk into the Net Standard library. I was offered three ways of resolving the problem.
Now, this struck me as very odd, since all the PDB files were sitting right there in the debug folder where the Net Traditional executable was. I tried all of the options, but none of them worked.
It turns out the problem is due to the default Visual Studio uses when it creates the PDB file for a Net Standard library. If you go to Properties -> Build -> Advanced, you’ll get a dialog box which, among other things, tells you that the PDB file is built with Portable information.
Well, it may be Portable. But it sure doesn’t support Net Traditional apps. For that, you need to set the output style to Full.
Once you do that, debugging a Net Traditional project which calls the Net Standard library works just as you expect, like it has for many, many years.