Example #1
0
        /// <summary>
        /// Retrieve callstack info from debugger(in PSHost proc)
        /// </summary>
        private void RefreshCallStack()
        {
            IEnumerable <CallStack> result = null;

            try
            {
                if (IsDebugging)
                {
                    result = DebuggingService.GetCallStack();
                }
                else
                {
                    throw new DebugEngineInternalException();
                }

                _callstack = new List <ScriptStackFrame>();
                if (result == null)
                {
                    return;
                }

                foreach (var psobj in result)
                {
                    _callstack.Add(
                        new ScriptStackFrame(
                            CurrentExecutingNode,
                            psobj.ScriptFullPath,
                            psobj.FrameString,
                            psobj.StartLine,
                            psobj.EndLine,
                            psobj.StartColumn,
                            psobj.EndColumn));
                }
            }
            catch (Exception ex)
            {
                Log.Error("Failed to refresh callstack", ex);
                throw;
            }
        }