Here is a function that returns a stacktrace on demand.
Per default you can use aStepsToSkip = 1 as you are not interested in the fact that the stacktrace started at buildStackTrace but you want the location where this function was called.
Public Shared Function buildStackTrace(Optional ByVal aStepsToSkip As Integer = 1) As String Dim stacktrace As New StackTrace(aStepsToSkip, True) Return stacktrace.ToString End Function



