示例#1
0
        private void OnDebugStopped(object sender, DebuggerStopEventArgs e)
        {
            var lineNumber = e.InvocationInfo.ScriptLineNumber - 2;

            // Notify the UI
            DebuggerStopped?.Invoke(this, new DebugEventArgs(lineNumber, _editorSession.DebugService.GetStackFrames()));
        }
示例#2
0
        private async void OnDebuggerStop(object sender, DebuggerStopEventArgs e)
        {
            var lineNumber = e.InvocationInfo.ScriptLineNumber - 2;

            // Create a waitable task so that we can continue when the user has chosen the appropriate action.
            _pipelineThreadId      = Thread.CurrentThread.ManagedThreadId;
            _debuggerExecutionTask =
                new TaskCompletionSource <DebuggerResumeAction>();

            // Create a pipeline execution task
            _pipelineExecutionTask =
                new TaskCompletionSource <IPipelineExecutionRequest>();

            // Get call stack and variables.
            await FetchStackFramesAndVariables();

            // Notify the UI
            DebuggerStopped?.Invoke(this, new DebugEventArgs(lineNumber, GetStackFrames()));

            while (true)
            {
                var taskIdx = Task.WaitAny(
                    _debuggerExecutionTask.Task,
                    _pipelineExecutionTask.Task);

                if (taskIdx == 0)
                {
                    // Set the resume action to what the user choose
                    try
                    {
                        e.ResumeAction = _debuggerExecutionTask.Task.Result;
                    }
                    catch (TaskCanceledException) { }
                    catch (AggregateException) { }
                    break;
                }
                else if (taskIdx == 1)
                {
                    try
                    {
                        var executionRequest = _pipelineExecutionTask.Task.Result;

                        _pipelineExecutionTask = new TaskCompletionSource <IPipelineExecutionRequest>();

                        executionRequest.Execute().Wait(_cancellationTokenSource.Token);
                        _pipelineResultTask.SetResult(executionRequest);
                    }
                    catch (TaskCanceledException) { }
                    catch (AggregateException) { }
                }
            }

            _debuggerExecutionTask = null;
        }
 private void RaiseDebuggerStoppedEvent() => DebuggerStopped?.Invoke(this, LastStopEventArgs);