private IEnumerable <StackFrameSourceCodeInfo> GetStackFrames(Exception original)
        {
            var stackFrames = StackTraceHelper.GetFrames(original, out var exception)
                              .Select(frame => GetStackFrameSourceCodeInfo(
                                          frame.MethodDisplayInfo?.ToString(),
                                          frame.FilePath,
                                          frame.LineNumber));

            if (exception != null)
            {
                _logger?.FailedToReadStackTraceInfo(exception);
            }

            return(stackFrames);
        }
示例#2
0
        public IEnumerable <ExceptionDetails> GetDetails(Exception exception)
        {
            var exceptions = FlattenAndReverseExceptionTree(exception);

            foreach (var ex in exceptions)
            {
                yield return(new ExceptionDetails
                {
                    Error = ex,
                    StackFrames = StackTraceHelper.GetFrames(ex)
                                  .Select(frame => GetStackFrameSourceCodeInfo(
                                              frame.MethodDisplayInfo.ToString(),
                                              frame.FilePath,
                                              frame.LineNumber))
                });
            }
        }