public static IEnumerable<StackFrame> GroupStackFrames(IEnumerable<StackFrame> stackTrace) {
bool inInterpretedFrame = false;
foreach (StackFrame frame in stackTrace) {
if (InterpretedFrame.IsInterpretedFrame(frame.GetMethod())) {
if (inInterpretedFrame) {
continue;
}
inInterpretedFrame = true;
} else {
inInterpretedFrame = false;
}
yield return frame;
}
}