From 87abf569a7f7d5f1e5bd3afd894173099a1366c5 Mon Sep 17 00:00:00 2001 From: Eusebiu Marcu Date: Tue, 19 Jul 2011 20:40:08 +0200 Subject: [PATCH] fix some null errors --- Debugger/Debugger.Core/Breakpoint.cs | 14 +++++--------- .../ILSpy.Debugger/Commands/DebuggerCommands.cs | 2 +- .../Services/Debugger/WindowsDebugger.cs | 3 ++- ILSpy/TextView/DecompilerTextView.cs | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Debugger/Debugger.Core/Breakpoint.cs b/Debugger/Debugger.Core/Breakpoint.cs index 0b5555538..68a9ea24f 100644 --- a/Debugger/Debugger.Core/Breakpoint.cs +++ b/Debugger/Debugger.Core/Breakpoint.cs @@ -45,11 +45,6 @@ namespace Debugger set { line = value; } } - public string TypeName { - get; - set; - } - public int Column { get { return column; } protected set { column = value; } @@ -75,6 +70,10 @@ namespace Debugger } } + public string TypeName { + get; protected set; + } + protected virtual void OnHit(BreakpointEventArgs e) { if (Hit != null) { @@ -176,12 +175,11 @@ namespace Debugger public class ILBreakpoint : Breakpoint { - public ILBreakpoint(NDebugger debugger, string typeName, string memberReferenceName, int line, int metadataToken, int offset, bool enabled) + public ILBreakpoint(NDebugger debugger, string typeName, int line, int metadataToken, int offset, bool enabled) { this.Debugger = debugger; this.Line = line; this.TypeName = typeName; - this.MemberReferenceName = memberReferenceName; this.MetadataToken = metadataToken; this.ILOffset = offset; this.Enabled = enabled; @@ -191,8 +189,6 @@ namespace Debugger public int ILOffset { get; private set; } - public string MemberReferenceName { get; private set; } - public override bool SetBreakpoint(Module module) { SourcecodeSegment segment = SourcecodeSegment.CreateForIL(module, this.Line, (int)MetadataToken, ILOffset); diff --git a/Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs b/Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs index 3a122360b..c3bbff34d 100644 --- a/Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs +++ b/Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs @@ -83,7 +83,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands public override void Execute(object parameter) { - DebugInformation.LoadedAssemblies = MainWindow.Instance.CurrentAssemblyList.GetAssemblies().Select(a => a.AssemblyDefinition); + } protected static IDebugger CurrentDebugger { diff --git a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs index b5614aab5..8aa104bdd 100644 --- a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs +++ b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs @@ -549,7 +549,6 @@ namespace ICSharpCode.ILSpy.Debugger.Services breakpoint = new ILBreakpoint( debugger, bookmark.MemberReference.DeclaringType.FullName, - bookmark.MemberReference.FullName, bookmark.LineNumber, bookmark.MemberReference.MetadataToken.ToInt32(), bookmark.ILRange.From, @@ -817,6 +816,8 @@ namespace ICSharpCode.ILSpy.Debugger.Services int ilOffset = frame.IP; string fullName = debugType.FullNameWithoutGenericArguments; + DebugInformation.LoadedAssemblies = MainWindow.Instance.CurrentAssemblyList.GetAssemblies().Select(a => a.AssemblyDefinition); + if (DebugInformation.LoadedAssemblies == null) throw new NullReferenceException("No DebugData assemblies!"); else { diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs index db9e6dddc..0c16ac2ea 100644 --- a/ILSpy/TextView/DecompilerTextView.cs +++ b/ILSpy/TextView/DecompilerTextView.cs @@ -456,7 +456,7 @@ namespace ICSharpCode.ILSpy.TextView int ilOffset = DebugInformation.DebugStepInformation.Item2; int line; MemberReference member; - if (!DebugInformation.CodeMappings.ContainsKey(token)) + if (DebugInformation.CodeMappings == null || !DebugInformation.CodeMappings.ContainsKey(token)) return; DebugInformation.CodeMappings[token].GetInstructionByTokenAndOffset(token, ilOffset, out member, out line);