コード例 #1
0
 public ExceptionRaisedEventArgs(NodeThread thread, NodeException exception, bool isUnhandled)
 {
     this.Thread      = thread;
     this.Exception   = exception;
     this.IsUnhandled = isUnhandled;
 }
 public ExceptionRaisedEventArgs(NodeThread thread, NodeException exception, bool isUnhandled) {
     _thread = thread;
     _exception = exception;
     _isUnhandled = isUnhandled;
 }
コード例 #3
0
        private void ReportException(ExceptionEvent exceptionEvent, string errorCode = null) {
            DebuggerClient.RunWithRequestExceptionsHandled(async () => {
                string exceptionName = exceptionEvent.ExceptionName;
                if (!string.IsNullOrEmpty(errorCode)) {
                    exceptionName = string.Format("{0}({1})", exceptionName, errorCode);
                }

                // UNDONE Handle break on unhandled, once just my code is supported
                // Node has a catch all, so there are no uncaught exceptions
                // For now just break always or never
                //if (exceptionTreatment == ExceptionHitTreatment.BreakNever ||
                //    (exceptionTreatment == ExceptionHitTreatment.BreakOnUnhandled && !uncaught)) {
                ExceptionHitTreatment exceptionTreatment = _exceptionHandler.GetExceptionHitTreatment(exceptionName);
                if (exceptionTreatment == ExceptionHitTreatment.BreakNever) {
                    await AutoResumeAsync(false).ConfigureAwait(false);
                    return;
                }

                // We need to get the backtrace before we break, so we request the backtrace
                // and follow up with firing the appropriate event for the break
                bool running = await PerformBacktraceAsync().ConfigureAwait(false);
                Debug.Assert(!running);

                // Handle followup
                EventHandler<ExceptionRaisedEventArgs> exceptionRaised = ExceptionRaised;
                if (exceptionRaised == null) {
                    return;
                }

                string description = exceptionEvent.Description;
                if (description.StartsWith("#<") && description.EndsWith(">")) {
                    // Serialize exception object to get a proper description
                    var tokenSource = new CancellationTokenSource(_timeout);
                    var evaluateCommand = new EvaluateCommand(CommandId, _resultFactory, exceptionEvent.ExceptionId);
                    if (await TrySendRequestAsync(evaluateCommand, tokenSource.Token).ConfigureAwait(false)) {
                        description = evaluateCommand.Result.StringValue;
                    }
                }

                var exception = new NodeException(exceptionName, description);
                exceptionRaised(this, new ExceptionRaisedEventArgs(MainThread, exception, exceptionEvent.Uncaught));
            });
        }
コード例 #4
0
 public ExceptionRaisedEventArgs(NodeThread thread, NodeException exception, bool isUnhandled)
 {
     _thread      = thread;
     _exception   = exception;
     _isUnhandled = isUnhandled;
 }