views:

448

answers:

4

Hi folks, i have the following line of code in VS2008.

    VirtualPathData virtualPathData = 
        RouteTable.Routes.GetVirtualPath(_viewContext.RequestContext, 
        "Home", 
        pageLinkValueDictionary);

I wish to debug this GetVirtualpath(..) method .. to see what it's trying to do.

I'm assuming i need to grab the symbols from the MS symbol server.

What i did was

  • Turn OFF Enable just my code
  • Turn ON Enable source server support
  • Show the Modules window when debugging (to manually load the correct module)

Compile in debug mode, put a breakpoint on that line about and debug-run. When i hit the line, i manually load in System.Web.Routing(..) from MS Symbol server. This works (the pdb is downloaded locally) and when i step INTO this line, i goto some Dissassemler code :(

Can anyone see what i'm doing wrong?

A: 

Looks like you're talking about .NET, so it's actually IL byte code you're seeing. I don't think Microsoft releases symbols with source code for .NET, so VS can't help you.

Use .NET Reflector to inspect what the function does.

Jamie
um ... Microsoft have released some symbol/pdb files for some of their .NET framework. I was under the impression that System.Web.Routing was one of them .. but i just can't get it working.
Pure.Krome
A: 

I'm a little surprised it downloaded a symbol file for that; last time I looked, there were only symbols for a small subset (mainly 2.0) of the framework. Are you having a problem with this code at the moment? If so, post details of the exception / unexpected behaviour. If you are simply curious, then either a: read the documentation, or b: perhaps have a snoop with reflector (caveat: "IANAL").

Marc Gravell
Hi Marc. this is the local symbols cache content from MS: ....MicrosoftPublicSymbols\System.Web.Routing.pdb\3DB015207A024718BF08F947E4A505941\System.Web.Routing.pdb (27 KB in size.) Because i have this file, I assumed i should be able to 'step into' it. I was trying to test out symbol debugging.
Pure.Krome
+2  A: 

That the symbols file is downloaded doesn't mean that sources are available for it, the pdb needs to be source indexed as well.

From Scott Guthrie's announcement:

We'll begin by offering the source code (with source file comments included) for the .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows). We'll then be adding more libraries in the months ahead (including WCF, Workflow, and LINQ). The source code will be released under the Microsoft Reference License (MS-RL).

It seems System.Web.Routing isn't included here.

You can however download the MVC Source, then you should be able to use the pdbs you downloaded against that source.

Sander Rijken
and what's the difference between a pdb and source? i thought the pdb was the source + extra info?
Pure.Krome
The pdb contains debug information, like function prototypes, meaning you'll get more accurate stack traces and local variable names etc. They *can* be annotated with information on how to get/download the source, this is how the reference sources get downloaded.
Sander Rijken
A: 

I saw someone get modded down already for saying this, but...

It does not seem that you can get a source-level view of what is going on, but if you really need an answer on why something might not be working (and StackOverflow cannot help), using Reflector.NET to get C# code from the compiled assembly (dll or exe) is a pretty good option. The tool is quite easy to use for any experienced .NET developer and can provide some very good insights into what is happening.

Many of us who work at the leading edge of .NET need to use it because there is often no other fast method, and for those without MVP or Microsoft-side connections, it is commonly the only way to get the 'inside story'.

JasonRShaver