Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"

like image 571
joedotnot Avatar asked Sep 30 '09 01:09

joedotnot


People also ask

What is the difference between step over and step into?

Ans: Step Into: Step Into is used for debugging the test steps line by line. When the procedure gets called, Step Into enables you to get inside the procedure and debugs the procedure steps line by line. Step Over: Step Over will enable, only after the debugging is started with Step Into / Run From Step / Run to Step.

How do I step into a function in Visual Studio?

Begin code stepping by selecting F10 or F11. Doing so allows you to quickly find the entry point of your app. You can then continue to press step commands to navigate through the code. Run to a specific location or function, for example, by setting a breakpoint and starting your app.

What is the difference between stepping into and stepping over the highlighted line of code in the VS code debugger?

Step Into The next expression on the currently-selected line to be executed is invoked, and execution suspends at the next executable line in the method that is invoked. Step Over The currently-selected line is executed and suspends on the next executable line.

What is step debugging?

Xdebug's step debugger allows you to interactively walk through your code to debug control flow and examine data structures.


2 Answers

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.

like image 168
McMuttons Avatar answered Sep 27 '22 19:09

McMuttons


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.

like image 21
Dan Finucane Avatar answered Sep 27 '22 17:09

Dan Finucane