From 18ab7bbb3cb65e2a9d4fdbb4bf3602733256d802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Thu, 10 Jul 2008 19:34:57 +0000 Subject: [PATCH] Use the fallback method is evaluation of Exception.StackTrace fails. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3213 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs | 8 +++++++- .../Debugger.Core/Project/Src/Debugger/Exception.cs | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs index dd9b0ccef7..755ce75fa4 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs @@ -607,7 +607,13 @@ namespace ICSharpCode.SharpDevelop.Services // Need to intercept now so that we can evaluate properties if (e.Process.SelectedThread.InterceptCurrentException()) { msg.AppendLine(e.Exception.ToString()); - msg.Append(e.Exception.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.EndOfInnerException}"))); + string stackTrace; + try { + stackTrace = e.Exception.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.EndOfInnerException}")); + } catch (GetValueException) { + stackTrace = e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}")); + } + msg.Append(stackTrace); } else { // For example, happens on stack overflow msg.AppendLine(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Error.CannotInterceptException}")); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs index 6857646bee..96a4f9e1fa 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs @@ -79,6 +79,9 @@ namespace Debugger return GetStackTrace("--- End of inner exception stack trace ---"); } + /// Returs formated stacktrace for the exception + /// Getting the stacktrace involves property + /// evaluation so GetValueException can be thrown in some cicumstances. public string GetStackTrace(string endOfInnerExceptionFormat) { StringBuilder sb = new StringBuilder();