简体   繁体   中英

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.

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.

在此处输入图片说明

尝试在调试设置中禁用我的代码,然后在“调试”->“窗口”->“模块”中导航并为外部软件包加载符号

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM