コード例 #1
0
 private void EnsureSourceFileInfo()
 {
     //this isn't thread-safe and that is OK
     if (!_fetchedFileInfo && _includeFileInfo)
     {
         StackTraceHelper.TryGetSourceLineInfo(_ip, out _fileName, out _lineNumber, out _columnNumber);
         //Even if we didn't get all the data, this is the best we'll get and we shouldn't try again
         _fetchedFileInfo = true;
     }
 }
コード例 #2
0
 public override string ToString()
 {
     return(StackTraceHelper.FormatStackTrace(_ips, _needFileInfo));
 }
コード例 #3
0
 public override string ToString()
 {
     return(StackTraceHelper.FormatStackFrame(_ip, _includeFileInfo));
 }
コード例 #4
0
        bool AddFrames(StringBuilder sb)
        {
            bool   printOffset;
            string debugInfo, indentation;
            string unknown = Locale.GetText("<unknown method>");

            indentation = "  ";
            debugInfo   = Locale.GetText(" in {0}:{1} ");

            var newline = String.Format("{0}{1}{2} ", Environment.NewLine, indentation,
                                        Locale.GetText("at"));

            int i;

            for (i = 0; i < FrameCount; i++)
            {
                StackFrame frame = GetFrame(i);
                if (i == 0)
                {
                    sb.AppendFormat("{0}{1} ", indentation, Locale.GetText("at"));
                }
                else
                {
                    sb.Append(newline);
                }

                if (frame.GetMethod() == null)
                {
                    string internal_name = frame.GetInternalMethodName();
                    if (internal_name != null)
                    {
                        sb.Append(internal_name);
                    }
                    else
                    {
                        sb.AppendFormat("<0x{0:x5} + 0x{1:x5}> {2}", frame.GetMethodAddress(), frame.GetNativeOffset(), unknown);
                    }
                }
                else
                {
                    StackTraceHelper.GetFullNameForStackTrace(sb, frame.GetMethod());

                    if (frame.GetILOffset() == -1)
                    {
                        sb.AppendFormat(" <0x{0:x5} + 0x{1:x5}>", frame.GetMethodAddress(), frame.GetNativeOffset());
                        if (frame.GetMethodIndex() != 0xffffff)
                        {
                            sb.AppendFormat(" {0}", frame.GetMethodIndex());
                        }
                    }
                    else
                    {
                        sb.AppendFormat(" [0x{0:x5}]", frame.GetILOffset());
                    }

                    sb.AppendFormat(debugInfo, frame.GetSecureFileName(),
                                    frame.GetFileLineNumber());
                }
            }

            return(i != 0);
        }