public static StackFrame GetTestEntryStackFrame(this StackTrace self) { var stackFrame = self.FindTestEntryFrame(); if (stackFrame == null) { throw new InvalidOperationException( "No method marked with TestAttribute was found in this StackTrace"); } return(stackFrame); }