Load .NET PDB Symbols from Microsoft

516 views Asked by At

I have set up a symbol server in VS 2010 according to this:

http://msdn.microsoft.com/en-us/library/vstudio/b8ttk8zy(v=vs.100).aspx

But my goal is to step into the Regex class in the RegularExpressions namespace:

Imports System.Text.RegularExpressions

Module Module1
    Sub Main()
        Dim matObject As Match = Regex.Match("abc", "a")
    End Sub
End Module

I do know that the RegularExpressions symbols in the System.dll Assembly were made public a long time ago because I read an article on it a while back that was excited about it and did a small overview. But I can't find the article.

As it stands, when I "Step Into" my Match function, it doesn't even give me the Step-Over dialog. It just steps over.

1

There are 1 answers

2
Suamere On BEST ANSWER

Turns out there are multiple issues surrounding this. Part of them include Visual Studio 2008 SP1, but that is hardly a relevant issue in late 2013.

The solution for me was... Don't use a Symbol Server. At least in VS 2010, it forces you to use the "Microsoft Symbol Servers" which, depending on one or two factors, may load from the generic location, or may load from http://referencesource.microsoft.com/symbols.

The problem with both, is that every time I've used those Symbol File Locations, they are stripped PDB's. Though as you might notice in the Subdomain "http://referencesource.microsoft.com/symbols", Reference Source is getting a big closer.

So what I did was navigate to: Download Source, which is at that same subdomain. Since I'm using .NET 4.0, I Downloaded the .NET 4.0 Source Files.

WTF?? So now I have downloaded some junk file named NetFramework.aspx. It just freezes my computer when I open it. What's the point? Well, nobody tells you this, but you have to re-name it to Whatever.msi. It's actually an installer.

Once you run the installer, you have the full symbols somewhere on your machine. YAY AGAIN!!! At that point, you need to make sure your Visual Studio is set up properly.

  1. Make sure your project Framework matches the Framework of your Source you just downloaded. (And/Or Vice Versa)
  2. Make sure "Enable .NET Framework Source Stepping" is enabled.
  3. For me, in my Options > Debugging > Symbols menu, I selected "Only Specified Modules" and I selected nothing there. Also, I un-checked the PDB Locations so nothing was selected.
  4. Sometimes the Platform Target is an issue. Mine is set to AnyCPU, but you may need to experiment?

OKAY!! All set, let's do this... Fail.

Now when you hit F11, it still just steps over the code. Well, if you look at your Modules (While running), HOPEFULLY the symbols for System or mscorlib or whatever your Assembly is says SYMBOLS NOT LOADED. (That's Good).

Why is that good? Because if they're loaded, you can't load them. And typically, if they're loaded, they are loaded from some janky stripped PDB location that gets you nowhere. So you right-click the assembly of choice and Load From Path... and go to wherever you installed those PDBs from the MSI.

Well great... now if you try to step into the .NET Framework code, or if you try to Load the code from the Call-Stack, you just get a missing code error and the option to find the source code is Greyed Out!! Well I thought we HAD The CODE!!!! I JUST LOADED IT.

Let's look back at the Module window. Next to the assembly you're wanting to load, you'll probably notice in the Version that it says something like "built by: RTMGDR" or "RTMRel" or something like that. Well, RTMGDR means the current version of code being used is different from the original. Why is it different? Because a KB Security Update was installed. And since the Code is different from the PDB... you can't step in.

Unfortunately, you can't get the latest PDB. Who knows why... maybe because it's a security update. But what you CAN do... is google your version like so:

"mscorlib.dll" 4.0.30319.xxx site:support.microsoft.com/kb

You do not have to click anything. Just look at the URL of the first result and you'll see the KB number like so:

support.microsoft.com/kb/12345

Open up your Add/Remove programs (Run: appwiz.cpl), and view Installed Updates. You'll VERY Easily find that KB under your Visual Studio group, and can Uninstall it.

Then run Visual Studio again.. and you'll probably see a new RTMGDR with an Older version... Google that, Remove it's KB... Rinse and Repeat.

KEEP TRACK OF THE KB's YOU REMOVE (In Order). So you can later Re-Install them after your Research.

Once you are FINALLY down to Version x.x.xxxx.1 (RTMRel), you run your Visual Studio to the break point... Open your Modules... Load Symbols From Path... Select your PDB's from your MSI... Then.... Step into your .NET Code

FINALLY!!!

Now when you're done, re-install those KB's, but keep all other settings the same for next time. Security is important.