<commit_before>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Text;

using Newtonsoft.Json;

namespace SharpRaven.Data {
    public class SentryStacktrace {
        public SentryStacktrace(Exception e) {
            StackTrace trace = new StackTrace(e, true);

            if (trace.GetFrames() != null)
            {
                int length = trace.GetFrames().Length;
                this.Frames = new ExceptionFrame[length];
                for (int i=0; i<length; i++) {
                    StackFrame frame = trace.GetFrame(length - i - 1);
                    this.Frames[i] = BuildExceptionFrame(frame);
                }
            }
        }

        private static ExceptionFrame BuildExceptionFrame(StackFrame frame)
        {
            int lineNo = frame.GetFileLineNumber();

            if (lineNo == 0)
            {
                //The pdb files aren't currently available
                lineNo = frame.GetILOffset();
            }

            var method = frame.GetMethod();
            return new ExceptionFrame()
            {
                Filename = frame.GetFileName(),
                Module = (method.DeclaringType != null) ? method.DeclaringType.FullName : null,
                Function = method.Name,
                Source = method.ToString(),
                LineNumber = lineNo,
                ColumnNumber = frame.GetFileColumnNumber()
            };
        }

        [JsonProperty(PropertyName = "frames")]
        public ExceptionFrame[] Frames { get; set; }

    }
}<commit_msg>Added XML documentation to SentryStacktrace<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Text;

using Newtonsoft.Json;

namespace SharpRaven.Data {
    /// <summary>
    /// Represents Sentry's version of an <see cref="Exception"/>'s stack trace.
    /// </summary>
    public class SentryStacktrace {
        /// <summary>
        /// Initializes a new instance of the <see cref="SentryStacktrace"/> class.
        /// </summary>
        /// <param name="e">The decimal.</param>
        public SentryStacktrace(Exception e) {
            StackTrace trace = new StackTrace(e, true);

            if (trace.GetFrames() != null)
            {
                int length = trace.GetFrames().Length;
                this.Frames = new ExceptionFrame[length];
                for (int i=0; i<length; i++) {
                    StackFrame frame = trace.GetFrame(length - i - 1);
                    this.Frames[i] = BuildExceptionFrame(frame);
                }
            }
        }

        private static ExceptionFrame BuildExceptionFrame(StackFrame frame)
        {
            int lineNo = frame.GetFileLineNumber();

            if (lineNo == 0)
            {
                //The pdb files aren't currently available
                lineNo = frame.GetILOffset();
            }

            var method = frame.GetMethod();
            return new ExceptionFrame()
            {
                Filename = frame.GetFileName(),
                Module = (method.DeclaringType != null) ? method.DeclaringType.FullName : null,
                Function = method.Name,
                Source = method.ToString(),
                LineNumber = lineNo,
                ColumnNumber = frame.GetFileColumnNumber()
            };
        }

        /// <summary>
        /// Gets or sets the <see cref="Exception"/> frames.
        /// </summary>
        /// <value>
        /// The <see cref="Exception"/> frames.
        /// </value>
        [JsonProperty(PropertyName = "frames")]
        public ExceptionFrame[] Frames { get; set; }

    }
}
{'fraction_non_alphanumeric': 0.10730655163116742, 'fraction_numerical': 0.0016176867080075492, 'mean_word_length': 1.6182074805928017, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '109565', 'n_tokens_mistral': 963, 'n_tokens_neox': 898, 'n_words': 230}