Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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'.

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").

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top