- if (stack_trace == null) {
- if (trace_ips == null)
- /* Not thrown yet */
- return null;
-
- StackTrace st = new StackTrace (this, 0, true, true);
-
- StringBuilder sb = new StringBuilder ();
-
- string newline = String.Format ("{0} {1} ", Environment.NewLine, Locale.GetText ("at"));
- string unknown = Locale.GetText ("<unknown method>");
-
- for (int i = 0; i < st.FrameCount; i++) {
- StackFrame frame = st.GetFrame (i);
- if (i == 0)
- sb.AppendFormat (" {0} ", 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}> {1}", frame.GetNativeOffset (), unknown);
- } else {
- GetFullNameForStackTrace (sb, frame.GetMethod ());
-
- if (frame.GetILOffset () == -1)
- sb.AppendFormat (" <0x{0:x5}> ", frame.GetNativeOffset ());
- else
- sb.AppendFormat (" [0x{0:x5}] ", frame.GetILOffset ());
-
- sb.AppendFormat ("in {0}:{1} ", frame.GetSecureFileName (),
- frame.GetFileLineNumber ());
- }
- }
- stack_trace = sb.ToString ();
- }