Visual Studio ignoring PDB files in output folder

I'm attempting to debug C# code I'm consuming via nuget packages, using VS2015. The package contains the DLL, PDB, and source code for the DLL in the following structure (suggested by the Nuget docs):

> lib
    > portable.etc.etc
        > x.dll
        > x.pdb
> src
    > *.cs
    > **/*.cs (etc.)
> x.nupkg

In the bin/Debug folder of my application, I can see the .pdb files copied out with the DLLs. From my understanding (of documentation about Visual Studio's debugger), the debugger should look in the same folder as the DLL for a PDB of the same name (or matching hash).

When I set a breakpoint using this configuration and try to step into the nuget package's code, a file explorer opens asking me to find the source file. If I do select the source file that shipped with the nuget package, I am able to set breakpoints but the debugger never stops on them. Thus, it seems to me that the PDBs are not being used at all.

Compiling the consuming program in Debug, nuget packages are also built in Debug configuration.

Enable Just My Code is unchecked.

How do I get Visual Studio to use the PDBs from the nuget package?

----------- UPDATE -------------------

Got it using the PDB from bin/Debug, after fixing some wacky configurations that were set by default in VS. (Address level debugging off). However, it still makes me search for the source file in a file explorer. Is there no way for VS to automatically open that source file, or is opening the file manually a burden my nuget package consumers will have to bear? To clarify, PDBs are loading automatically. I want to automatically load C# source files that VS is instead making me look up manually in a file explorer.


尝试在调试设置中禁用我的代码,然后在Debug - > window - > modules中导航,并为外部程序包加载符号


You need to make sure that you have "Enable Just My Code" unchecked to step through third party .pdb files.

Go to: Tools -> Options -> Debugging -> Uncheck "Enable Just My Code"

It will read the source information from the pdb if available and matches. The pdb file should match the corresponding dll file to work properly, meaning from the same build.

在这里输入图像描述

链接地址: http://www.djcxy.com/p/74566.html

上一篇: 在Visual Studio中使用Pdb文件和源代码文件进行调试

下一篇: Visual Studio忽略输出文件夹中的PDB文件