joedotnot
joedotnot

Reputation: 5133

Stepping over method without symbols - How to step into?

Using Visual Studio 2008 SP1 and a VB.NET project; I have some code which i cannot step into. The Immediate Window shows the message "Stepping over method without symbols 'Some.Namespace.Here'"

How can i make sure the method always has symbols?! I need to step into every line of code. I am pressing F8 (which is "Step Into" in VS2008, from memory i think it used to be F11 in VS2005).

This debugger stuff has always confused me: At the Solution level Property Pages i see a configuration dropdown with 4 values: Active (Debug), Debug, Release, All Configurations. - currently set to "Active (Debug)" At the Project level, i see a configuration dropdown with 2 values: Debug, Release. - currently set to "Debug"

Upvotes: 10

Views: 7834

Answers (3)

Dan Finucane
Dan Finucane

Reputation: 1587

I ran into the same exact problem in Visual Studio 2010. I would attempt to step into .NET Framework source, Visual Studio would step over it, the output window would say that it couldn't step into because the symbol file wasn't loaded but when I looked at the modules window I would see that the relevant symbol file was in fact loaded.

The problem was that the .NET symbol file was loaded but it was not the .NET symbol file with source information included. Microsoft's public symbol server at http://referencesource.microsoft.com/symbols contains symbols with source information included. Microsoft's public symbol server at http://msdl.microsoft.com/download/symbols contains symbols without source information.

One solution is to set you _NT_SYMBOL_PATH correctly so that it grabs .NET Framework symbols from http://referencesource.microsoft.com/symbols if they exist and from http://msdl.microsoft.com/download/symbols otherwise. Something like this would work:

_NT_SYMBOL_PATH=SRV*d:\SymbolsCache*http://referencesource.microsoft.com/symbols;SRV*d:\SymbolsCache*http://msdl.microsoft.com/download/symbols

This _NT_SYMBOL_PATH will get the debugger to first look for symbols with source information and then if there are none it will get the symbols without it. When Visual Studio has a symbol file with the source information it is able to step into that code.

Upvotes: 4

McMuttons
McMuttons

Reputation: 891

I know this is an old question, but are you perhaps using yield functionality in a method that returns an IEnumerable?

For example (contrived):

public IEnumerable<object> GetObjects(IEnumerable<object> objects)
{
    foreach(var obj in objects)
        yield return obj;
}

I run into this in my unit tests often, but due to lazy evaluation, yield statements don't process until it is necessary. One way to force enumeration is to tack a .ToList() to the calling statement for example, though you wouldn't want to do that permanently unless the call is perhaps a test for some functionality where the enumeration itself isn't important.

So doing the following should result in enumeration:

GetObjects(new List<object>()).ToList();

In short, if you're calling a method that requires enumeration, but then never enumerate the result, you will get that error in the output. This could happen with LINQ statements as well, like .Select.

Edit: Didn't notice that it was a VB.NET project, but I'm pretty sure the principle still stands.

Upvotes: 22

Kevin LaBranche
Kevin LaBranche

Reputation: 21078

If the namespace in question is a third party dll that didn't come with the symbols (pdb file) then this will occur. In order to "step into" the symbol file is needed.

If it's your own code then you would just need to double check that your symbol files exist. Having it set to debug at the project level should do this.

Upvotes: 0

Related Questions