Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access symbols published in VSTS Symbol server from visual studio

I'm able to successfully publish symbols to the VSTS symbol server as part of the build execution.

Symbol publish log

Followed this link to setup visual studio and everything good until this point. My symbol settings shown below:

enter image description here

When trying to debug, visual studio hits VSTS symbol server but return error message “Cannot find or open PDB file”

enter image description here

Below is the symbol load information provided by visual studio after trying to fetch from VSTS symbol server enter image description here

like image 644
Suresh Raja Avatar asked Oct 28 '22 14:10

Suresh Raja


1 Answers

As of November 15 2017 Visual Studio Online (also now known as Azure DevOps) the Index Sources and Publish Symbols build step handles the new portable PDB's create by dotnet build

You should tick Publish symbols and select your Subscription. The free tier has 5 users. You need to assign each user access to symbol server.

Ticking the Index Sources check box makes no sense though as the source files are on the build server, usually in an obscure location such as C:\agent\_work\34\s\... which will not match your local (or network path) to the source files.

To help Visual Studio find the source files you can do this... (you can avoid this by using SourceLink as described below)

  • Select the solution in Solution Explorer and then choose Properties from the shortcut menu.
  • Under the Common Properties node, choose Debug Source Files.
  • Click the folder Tools/ Options/ Debugging/Symbols folder icon icon. Editable text appears in the Directories containing source code list.
  • Add the path that you want to search.

When you start debugging all the symbols will download and you can step into the source code now.

This does NOT require disabling just my code and you do not need to enable source server either.


Unless you are using, or would like to use source server. It is pretty easy to do now by adding a few packages...

With AzureDev ops you can modify your build pipeline to make use of soruce files stored in GIT byt following this guide.

The prerequisite is .NET Core SDK 2.1.300 or desktop msbuild version 15.7.

On your package project project you need to add NuGet package "SourceLink.Create.CommandLine" which will enable your build server (and your local build machine) to rewrite parts of the Portable PDB's without changing anything in the build pipeline.

You also need to add a package to the correct source control. As described in this article. - I am using VSTS so I just install "Microsoft.SourceLink.Vsts.Git" package (must enable Include Prelease as of writing now)

To verify this works all you need to do is build the project and look inside \obj\{config}\{tfm}\ for a file called *.sourcelink.json and has the correct URL's inside it.

Then the usual pack and publish you would do.

In Visual Studio you just need to enable

  • Enable Source server support
  • Enable Source Link support
like image 182
Piotr Kula Avatar answered Nov 08 '22 10:11

Piotr Kula