From 8a9a7584a027e9112442dad2c9b9ee09332a71a1 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 27 Apr 2015 11:23:00 -0700 Subject: [PATCH 1/2] #42 Azure remote debugging - breaking doesn't work We've started trying to read the source file when listing frames, but we weren't handling the case where we couldn't load the file. --- .../Product/Debugger/Debugger/PythonProcess.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Python/Product/Debugger/Debugger/PythonProcess.cs b/Python/Product/Debugger/Debugger/PythonProcess.cs index 5ce2d6cac0..3695ba49ef 100644 --- a/Python/Product/Debugger/Debugger/PythonProcess.cs +++ b/Python/Product/Debugger/Debugger/PythonProcess.cs @@ -506,16 +506,23 @@ internal IList GetThreads() { internal PythonAst GetAst(string filename) { PythonAst ast; lock (_astCacheLock) { - _astCache.TryGetValue(filename, out ast); + if (_astCache.TryGetValue(filename, out ast)) { + return ast; + } } - if (ast == null) { + try { using (var source = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) { ast = Parser.CreateParser(source, LanguageVersion).ParseFile(); - lock (_astCacheLock) { - _astCache[filename] = ast; - } } + } catch (IOException) { + } catch (UnauthorizedAccessException) { + } catch (NotSupportedException) { + } catch (System.Security.SecurityException) { + } + + lock (_astCacheLock) { + _astCache[filename] = ast; } return ast; From c6dd077436a15fc46b975080f72d579bb3c1eab7 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 27 Apr 2015 11:55:30 -0700 Subject: [PATCH 2/2] Also catch argument exceptions when reading ASTs. --- Python/Product/Debugger/Debugger/PythonProcess.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/Product/Debugger/Debugger/PythonProcess.cs b/Python/Product/Debugger/Debugger/PythonProcess.cs index 3695ba49ef..ad7cb7d06c 100644 --- a/Python/Product/Debugger/Debugger/PythonProcess.cs +++ b/Python/Product/Debugger/Debugger/PythonProcess.cs @@ -515,6 +515,7 @@ internal PythonAst GetAst(string filename) { using (var source = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) { ast = Parser.CreateParser(source, LanguageVersion).ParseFile(); } + } catch (ArgumentException) { } catch (IOException) { } catch (UnauthorizedAccessException) { } catch (NotSupportedException) {