"[Lightweight Function]" in the call stack

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


Looks like this is a DynamicMethod. See this for some insight.

I'm not sure about stepping into a dynamic method, though.


Callstack for DynamicMethod (both in Debug and Release mode):

[Lightweight Function]  
[Native to Managed Transition]  
mscorlib.dll!System.Reflection.Emit.DynamicMethod.Invoke(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture) + 0x199 bytes

Pure

[Lightweight Function]

frame can be observed when a delegate to a dynamic method is called.