Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


Find out who called a .NET method

When debugging, it is useful to know who called a method (if it is being called from multiple places)

Include these

Imports System.Reflection
Imports System.Diagnostics

Place this code on the beginning of the method being called.

Dim st As StackTrace = New StackTrace()
Dim sf As StackFrame = st.GetFrame(1)
MsgBox("I was called by: " & sf.GetMethod.Name)


Enter your comment:
R J᠎ C D G
development/net/who_called.txt · Last modified: 2019/10/31 09:04 (external edit)