How to debug a referenced dll (having pdb)

后端 未结 10 1751
孤独总比滥情好
孤独总比滥情好 2020-11-27 09:49

I have two solutions in my workspace, say A and B.

Solution A is an older project which I finished coding some time ago. In solution B, I need to use some classes fr

相关标签:
10条回答
  • 2020-11-27 10:33

    I had the same issue. He is what I found:

    1) make sure all projects are using the same Framework (this is crucial!)

    2) in Tools/Options>Debugging>General make sure "Enable Just My Code (Managed Only) is NOT ticked

    3) in Tools/Options>Debugging>Symbols clear any cached symbols, untick and delete all folder locations under the "Symbols file (.pdb) locations" listbox except the default "Microsoft Symbol Servers" but still untick it too. Also delete any static paths in the "Cache symbols in this directory" textbox. Click the "Empty Symbols Cache" button. Finally make sure the "Only specified modules" radio button is ticked.

    4) in the Build/Configuration Manager menu for all projects make sure the configuration is in Debug mode.

    0 讨论(0)
  • 2020-11-27 10:34

    If you have a project reference, it should work immediately.

    If it is a file (dll) reference, you need the debugging symbols (the "pdb" file) to be in the same folder as the dll. Check that your projects are generating debug symbols (project properties => Build => Advanced => Output / Debug Info = full); and if you have copied the dll, put the pdb with it.

    You can also load symbols directly in the IDE if you don't want to copy any files, but it is more work.

    The easiest option is to use project references!

    0 讨论(0)
  • 2020-11-27 10:34

    Make sure your DLL is not registered in the GAC. Visual Studio will use the version in the GAC and it will probably have no debugging information.

    0 讨论(0)
  • 2020-11-27 10:35

    The most straigh forward way I found using VisualStudio 2019 to debug an external library to which you are referencing in NuGet, is by taking the following steps:

    1. Tools > Options > Debugging > General > Untick 'Enable Just My Code'

    2. Go to Assembly Explorer > Open from NuGet Packages Cache

    3. Type the NuGet package name you want to debug in the search field & click 'OK'

    4. From the Assembly Explorer, right-click on the assembly imported and select 'Generate Pdb'

    5. Select a custom path where you want to save the .PDB file and the framework you want this to be generated for

    6. Copy the .PDB file from the folder generated to your Debug folder and you can now set breakpoints on this assembly's library code

    0 讨论(0)
提交回复
热议问题