From f4ef84eb8baae8dd3491dcbc91312bb7d1abf81f Mon Sep 17 00:00:00 2001 From: Andreas Hollandt Date: Fri, 28 Aug 2020 00:22:27 +0200 Subject: [PATCH] move check to HandleStackTraceRequest and do it in parallel with a timeout --- src/OpenDebugAD7/AD7DebugSession.cs | 15 ++++++++++++++- src/OpenDebugAD7/TextPositionTuple.cs | 5 ----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/OpenDebugAD7/AD7DebugSession.cs b/src/OpenDebugAD7/AD7DebugSession.cs index 6be6f1aa3..271f98fe6 100644 --- a/src/OpenDebugAD7/AD7DebugSession.cs +++ b/src/OpenDebugAD7/AD7DebugSession.cs @@ -1288,7 +1288,7 @@ protected override void HandleStackTraceRequestAsync(IRequestResponder + { + if (frame.Source == null) + return; + var task = new Task(() => File.Exists(frame.Source.Path)); + task.Start(); + if (task.Wait(500) && !task.Result) + { + // mark the stack frame to be skipped by default + frame.Source.PresentationHint = Source.PresentationHintValue.Deemphasize; + } + }); + response.TotalFrames = (int)frameEnumInfo.TotalFrames; } } diff --git a/src/OpenDebugAD7/TextPositionTuple.cs b/src/OpenDebugAD7/TextPositionTuple.cs index 1ef3d4d8d..b6f804c9c 100644 --- a/src/OpenDebugAD7/TextPositionTuple.cs +++ b/src/OpenDebugAD7/TextPositionTuple.cs @@ -41,11 +41,6 @@ public static TextPositionTuple GetTextPositionOfFrame(PathConverter converter, Path = convertedFilePath, Name = Path.GetFileName(convertedFilePath) }; - if (!File.Exists(convertedFilePath)) - { - // mark the stack frame to be skipped by default - source.PresentationHint = Source.PresentationHintValue.Deemphasize; - } int line = converter.ConvertDebuggerLineToClient((int)beginPosition[0].dwLine); int column = unchecked((int)(beginPosition[0].dwColumn + 1));