且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在调试时让 Visual Studio 使用嵌入式源代码?

更新时间:2023-01-30 21:38:19

Easiest way is to go to:

Debug -> Windows -> Modules

Inside this list, you should be able to find your assembly (dll/exe).

Right click it -> Load Symbols

It will ask for where to load the symbols from.

Navigate to the directory where your matching .pdb file is.

It should auto load. Stepping into, or having uncaught errors in this referenced assembly should trigger a break in that code, or ask you to navigate to the code file that corresponds to the file that threw the error.

In our process, we generally have to navigate to the nuget cache to find the pdbs for our installed nuget packages. (%UserProfile%/nuget/packages/YourPackage/VersionNumber/../..)

We also package up the source with those packages and navigate to those /nuget/packages .cs files as well, though, any corresponding .cs file should allow it to load.