2

I have my Nuget library uploaded into Azure Devops Artifacts. It also has the Symbols file (.PDB) published to the Azure Devops symbols server. I have added settings in my Visual studio to load symbols from the Azure Devops Symbols server as well by following the instructions mentioned here.

During the runtime, when I try to StepInto the code (of Nuget library) then I get error saying unable to find the path of the .cs file. I have tried various solutions proposed like Uncheck the Enable Just-in time code, Enable .Net Framework Source Stepping etc. But no luck.

Question is:

  • I have build the nuget package using the build configuration as Release. Is that the reason why I m unable to step-into the Code? I thought having a PDB files loaded in VS should help overcome this. Please advise.
Sai
  • 629
  • 1
  • 8
  • 26
  • Debug your program and open the 'Modules' window(Debug ► Windows ► Modules). Find the row in this table corresponding to your DLL, is the 'Symbols File' column populated? – simon-pearson Apr 02 '20 at 15:04
  • Further - if the 'Symbols File' column isn't populated for your DLL then get the path of the DLL, and browse to the directory containing the DLL in Explorer, is the PDB file in there? – simon-pearson Apr 02 '20 at 15:07
  • I have checked the Modules window while debugging and it says symbols are loaded. I checked the path of the pdb file and the actual .pdb file is found in that path. – Sai Apr 02 '20 at 15:10
  • Oh, I missed you've built the package as 'Release' - yeah try a 'Debug' build. – simon-pearson Apr 02 '20 at 16:02
  • I have tried with Debug build and it worked. But how can I use Debug build for production? – Sai Apr 02 '20 at 23:00
  • Actually It should work though your package are built with release mode, just followed the document and made sure it could work well if all steps were right. Could you please share some details about how you define the pipeline tasks so that I can check it for you? – LoLance Apr 03 '20 at 05:29

1 Answers1

1

I have build the nuget package using the build configuration as Release. Is that the reason why I m unable to step-into the Code? I thought having a PDB files loaded in VS should help overcome this.

That's not the reason why you can't step-into the code. It should work even when you're using a nuget package built from Release mode. Please check these three tips:

1.Make sure you select same settings like mine when using Index sources and publish symbols task to publish symbols for debugging.

enter image description here

2.In Visual Studio, add new symbol server (the organization which owns the pipeline and hosts the artifact feed):

enter image description here

3.Uncheck enable just my code in debug=>general:

enter image description here

Then it worked well on my side. Hope my steps make some help. More info about this topic you can refer to this blog.

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • 1
    This worked like a charm. Thanks. I was missing the enable Source server support checkbox. – Sai Apr 03 '20 at 10:10
  • I m got the error back again. This time it said - The file 'd:\a\1\s\<>\<>.cs' does not exist. This the path of the CI pipeline hosted agent. I have all the settings as mentioned above. – Sai Apr 16 '20 at 12:20
  • Strangely though, when I tested this with .net framework nuget package. It popped up a window asking whether to download from the sourceserver and after I chose the server then it worked fine. Whereas when I try to debug with a .NetStandard project nuget package then it didnt give me the option to download and it simply gave me the above error. – Sai Apr 16 '20 at 12:32
  • 1
    Check [this](https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/symbols?toc=%2Fazure%2Fdevops%2Fartifacts%2Ftoc.json&view=azure-devops#qa): `source indexing is currently not enabled for portable .pdb files because SourceLink doesn't support authenticated source repositories. The workaround at the moment is to configure the build to generate full .pdb files.` – LoLance Apr 17 '20 at 01:49
  • Just a guess, I think your issue is related to this cause .net core project will be built by default with portal mode! Workaround is to set the debug information to Full. (Project=>Properties=>Build=>Advanced=>Debug information) Note if you want to debug with release package, you need to make sure you build release with full mode instead of debug full mode. (Project=>Properties=>release configuration=>similar steps above) – LoLance Apr 17 '20 at 01:53
  • I coudn't make it work on release mode, didn't step into – Luiz Bicalho May 19 '20 at 15:44
  • Does the pdb is generated in release mode with full debug symbol? – LoLance May 20 '20 at 09:52