Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Belyaev <usrsse2@me.com>2019-05-14 17:01:56 +0300
committerJeffrey Stedfast <jestedfa@microsoft.com>2019-05-28 18:26:39 +0300
commit75f0d3d66dbe68cf047948dc88c143257bb12a8f (patch)
treeeaafa91ff8f958b5cd4212f290319eca6cb078a4 /main/src/addins
parent872095311e3a288fd2350a4ecd9c743aa3ffc54e (diff)
Support "Include subclasses" not only for System.Exception; get rid of
regex parsing; remove condition calculation for regular breakpoints as the debugger already does it.
Diffstat (limited to 'main/src/addins')
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs17
1 files changed, 4 insertions, 13 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs
index 9c96088a36..7aa028d0a2 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs
@@ -39,7 +39,6 @@ using MonoDevelop.Core;
using MonoDevelop.Core.Execution;
using MonoFunctionBreakpoint = Mono.Debugging.Client.FunctionBreakpoint;
using VsCodeFunctionBreakpoint = Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages.FunctionBreakpoint;
-using System.Text.RegularExpressions;
namespace MonoDevelop.Debugger.VsCodeDebugProtocol
{
@@ -320,11 +319,10 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
var response = protocolClient.SendRequestSync (new EvaluateRequest (exp, frameId)).Result;
if (bool.TryParse (response, out var result))
return result;
+ OnDebuggerOutput (false, $"The condition for an exception catchpoint failed to execute. The condition was '{exp}'. The error returned was '{response}'.\n");
return null;
}
- private static readonly Regex VsdbgExceptionNameRegex = new Regex ("Exception thrown: '(.*)' in .*");
-
protected void HandleEvent (object sender, EventReceivedEventArgs obj)
{
Task.Run (() => {
@@ -348,13 +346,6 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
} else {
args.BreakEvent = bp;
if (breakpoints.TryGetValue (bp, out var binfo)) {
- if (bp.ConditionExpression != null) {
- if (EvaluateCondition(stackFrame.frameId, bp.ConditionExpression) == false) {
- OnContinue ();
- return;
- }
- }
-
if ((bp.HitAction & HitAction.PrintExpression) != HitAction.None) {
string exp = EvaluateTrace (stackFrame.frameId, bp.TraceExpression);
binfo.UpdateLastTraceValue (exp);
@@ -369,11 +360,11 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
args = new TargetEventArgs (TargetEventType.TargetStopped);
break;
case StoppedEvent.ReasonValue.Exception:
- var match = VsdbgExceptionNameRegex.Match (body.Text);
stackFrame = (VsCodeStackFrame)this.GetThreadBacktrace (body.ThreadId ?? -1).GetFrame (0);
- if (match.Success && match.Groups.Count == 2 && !breakpoints.Select (b => b.Key).OfType<Catchpoint> ().Any (e =>
+ if (!breakpoints.Select (b => b.Key).OfType<Catchpoint> ().Any (e =>
e.Enabled &&
- (match.Groups[1].Value == e.ExceptionName || e.IncludeSubclasses && e.ExceptionName == "System.Exception") &&
+ (e.ExceptionName.Contains ("::") ? e.ExceptionName : $"global::{e.ExceptionName}") is var qualifiedExceptionType && // global:: is necessary if the exception type is contained in current namespace, and it also contains a class with the same name as the namespace itself. Example: "Tests.Tests" and "Tests.TestException"
+ (e.IncludeSubclasses && EvaluateCondition(stackFrame.frameId, $"$exception is {qualifiedExceptionType}") != false || !e.IncludeSubclasses && EvaluateCondition(stackFrame.frameId, $"$exception.GetType() == typeof({qualifiedExceptionType})") != false) &&
(string.IsNullOrWhiteSpace(e.ConditionExpression) || EvaluateCondition (stackFrame.frameId, e.ConditionExpression) != false)))
{
OnContinue ();