diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs index c5f59496b7..0b6e33ed2f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs @@ -127,7 +127,14 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads exceptionHistoryList.Items.Clear(); foreach(DebuggerLibrary.Exception exception in debugger.ExceptionHistory) { - ListViewItem item = new ListViewItem(new string[] {exception.CreationTime.ToLongTimeString() , exception.Type + " - " + exception.Message, exception.Location.SourceFilename + ":" + exception.Location.StartLine + " (type=" + exception.ExceptionType.ToString() + ")"}); + string location; + if (exception.Location != null) { + location = exception.Location.SourceFilename + ":" + exception.Location.StartLine; + } else { + location = "n/a"; + } + location += " (type=" + exception.ExceptionType.ToString() + ")"; + ListViewItem item = new ListViewItem(new string[] {exception.CreationTime.ToLongTimeString() , exception.Type + " - " + exception.Message, location}); item.Tag = exception; item.ForeColor = Color.Black; if (exception.ExceptionType == ExceptionType.DEBUG_EXCEPTION_UNHANDLED) { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs index 45db581294..456f25753e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs @@ -49,7 +49,10 @@ namespace DebuggerLibrary message = runtimeVariableException.SubVariables["_message"].Value.ToString(); } - location = thread.LastFunctionWithLoadedSymbols.NextStatement; + if (thread.LastFunctionWithLoadedSymbols != null) { + location = thread.LastFunctionWithLoadedSymbols.NextStatement; + } + callstack = ""; foreach(Function function in thread.Callstack) { SourcecodeSegment loc = function.NextStatement;