Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"[Lightweight Function]" in the call stack

Tags:

I'm debugging a program (VS2008), and I was stepping through lines of code. I came across one line where a delegate function was being called, and I tried to step into it. However, rather than stepping into the method as I expected, the method was bypassed, with the debugger instead stepping into what I assume is a function called by the delegate. In the call stack, the line where I expected the delegate method to be is greyed out with the text [Lightweight Function].

What does the "Lightweight Function" part mean? Is there a way to step into this function?

like image 717
Smashery Avatar asked Aug 31 '09 05:08

Smashery


People also ask

What does the call stack IDE window contain?

The Call Stack window shows the order in which methods and functions are getting called. The call stack is a good way to examine and understand the execution flow of an app.

What is call stack in debugging?

The call stack is a list of all the active functions that have been called to get to the current point of execution. The call stack includes an entry for each function called, as well as which line of code will be returned to when the function returns.

What is call stack in Visual Studio code?

Call stack is very useful when Inspecting the program state. You can see the function calls that are currently on the stack, change the context in which you are debugging to another stack frame on the call stack and inspect the program state in the different frames.


1 Answers

I believe a lightweight function refers to a DynamicMethod, i.e. one that is emitted at runtime, used, and then unloaded.

This blog post is related to Iron Python, but the information should be good for any .NET project: Viewing Emitted IL. The author shows you how to use a lower level debugger (windbg.exe) to see these "lightweight functions."

like image 181
bobbymcr Avatar answered Oct 03 '22 04:10

bobbymcr