예제 #1
0
        private void DumpStackTrace(StackTrace st, FilterStackFrame fsf)
        {
            StackFrame[] frames = st.GetFrames();
            if (frames == null)
            {
                return;
            }

            for (int i = frames.Length - 1; i >= 0; i--)
            {
                StackFrame frame      = frames[i];
                Type       parentType = frame.GetMethod().DeclaringType;
                if (parentType != null)
                {
                    string typeName = parentType.FullName;
                    if (typeName.StartsWith("IronPython.") ||
                        typeName.StartsWith("ReflectOpt.") ||
                        typeName.StartsWith("System.Reflection.") ||
                        typeName.StartsWith("System.Runtime") ||
                        typeName.StartsWith("IronPythonConsole."))
                    {
                        continue;
                    }
                }

                if (fsf != null && !fsf(frame))
                {
                    continue;
                }

                MyConsole.WriteLine(FrameToString(frame), Style.Error);
            }
        }
예제 #2
0
        private void DumpStackTraces(Exception e, FilterStackFrame fsf, ref bool printedHeader)
        {
            if (PythonEngine.options.ExceptionDetail)
            {
                if (!printedHeader)
                {
                    MyConsole.WriteLine(e.Message, Style.Error);
                    printedHeader = true;
                }
                List <System.Diagnostics.StackTrace> traces = ExceptionConverter.GetExceptionStackTraces(e);

                if (traces != null)
                {
                    for (int i = 0; i < traces.Count; i++)
                    {
                        for (int j = 0; j < traces[i].FrameCount; j++)
                        {
                            StackFrame curFrame = traces[i].GetFrame(j);
                            if (fsf == null || fsf(curFrame))
                            {
                                MyConsole.WriteLine(curFrame.ToString(), Style.Error);
                            }
                        }
                    }
                }

                MyConsole.WriteLine(e.StackTrace.ToString(), Style.Error);
                if (e.InnerException != null)
                {
                    DumpStackTraces(e.InnerException, ref printedHeader);
                }
            }
            else
            {
                // dump inner most exception first, followed by outer most.
                if (e.InnerException != null)
                {
                    DumpStackTraces(e.InnerException, ref printedHeader);
                }

                if (!printedHeader)
                {
                    MyConsole.WriteLine("Traceback (most recent call last):", Style.Error);
                    printedHeader = true;
                }
                DumpStackTrace(new StackTrace(e, true), fsf);
                List <StackTrace> traces = ExceptionConverter.GetExceptionStackTraces(e);
                if (traces != null && traces.Count > 0)
                {
                    for (int i = 0; i < traces.Count; i++)
                    {
                        DumpStackTrace(traces[i], fsf);
                    }
                }
            }
        }
예제 #3
0
        public void DumpException(Exception e, object pythonException, FilterStackFrame fsf)
        {
            Debug.Assert(pythonException != null);
            Debug.Assert(e != null);

            bool printedHeader = false;

            DumpStackTraces(e, fsf, ref printedHeader);
            DumpPythonException(pythonException);
            if (PythonEngine.options.ShowCLSExceptions)
            {
                DumpCLSException(e);
            }
        }
 public static void DumpException(FilterStackFrame fsf)
 {
 }
예제 #5
0
파일: test-501.cs 프로젝트: xzkmxd/mono
	public static void DumpException(FilterStackFrame fsf) {
	}