diff --git a/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs b/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
index 37811b7f1..33b07ad59 100644
--- a/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
+++ b/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
@@ -161,11 +161,11 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
if (instruction == null)
return;
- TypeDefinition type;
+ MemberReference memberReference;
int newline;
- if (newMappings.GetSourceCodeFromMetadataTokenAndOffset(markerType.FullName, token, instruction.ILInstructionOffset.From, out type, out newline)) {
+ if (newMappings.GetSourceCodeFromMetadataTokenAndOffset(markerType.FullName, token, instruction.ILInstructionOffset.From, out memberReference, out newline)) {
// 4. create breakpoint for new languages
- CurrentLineBookmark.SetPosition(type, newline, 0, newline, 0);
+ CurrentLineBookmark.SetPosition(memberReference, newline, 0, newline, 0);
}
}
@@ -195,11 +195,11 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
if (instruction == null)
continue;
- TypeDefinition type;
+ MemberReference memberReference;
int line;
- if (newMappings.GetSourceCodeFromMetadataTokenAndOffset(bp.Member.FullName, token, instruction.ILInstructionOffset.From, out type, out line)) {
+ if (newMappings.GetSourceCodeFromMetadataTokenAndOffset(bp.Member.FullName, token, instruction.ILInstructionOffset.From, out memberReference, out line)) {
// 2. create breakpoint for new languages
- var bookmark = new BreakpointBookmark(type, new AstLocation(line, 0), BreakpointAction.Break, newLanguage);
+ var bookmark = new BreakpointBookmark(memberReference, new AstLocation(line, 0), BreakpointAction.Break, newLanguage);
AddMark(bookmark);
}
}
diff --git a/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs b/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs
index 89094f762..d0788788a 100644
--- a/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs
+++ b/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs
@@ -24,7 +24,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
static int endLine;
static int endColumn;
- public static void SetPosition(TypeDefinition type, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn)
+ public static void SetPosition(MemberReference memberReference, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn)
{
Remove();
@@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
endLine = makerEndLine;
endColumn = makerEndColumn;
- instance = new CurrentLineBookmark(type, new AstLocation(startLine, startColumn));
+ instance = new CurrentLineBookmark(memberReference, new AstLocation(startLine, startColumn));
BookmarkManager.AddMark(instance);
}
@@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
get { return 100; }
}
- public CurrentLineBookmark(TypeDefinition type, AstLocation location) : base(type, location)
+ public CurrentLineBookmark(MemberReference member, AstLocation location) : base(member, location)
{
}
diff --git a/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs b/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs
index efa35ad45..eedcb1cec 100644
--- a/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs
+++ b/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs
@@ -184,9 +184,9 @@ namespace ICSharpCode.ILSpy.Debugger.Services
CurrentLineBookmark.Remove();
}
- public static void JumpToCurrentLine(TypeDefinition type, int startLine, int startColumn, int endLine, int endColumn)
+ public static void JumpToCurrentLine(MemberReference memberReference, int startLine, int startColumn, int endLine, int endColumn)
{
- CurrentLineBookmark.SetPosition(type, startLine, startColumn, endLine, endColumn);
+ CurrentLineBookmark.SetPosition(memberReference, startLine, startColumn, endLine, endColumn);
}
#region Tool tips
diff --git a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
index efe1903bc..e3e8c4917 100644
--- a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
+++ b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
@@ -823,12 +823,12 @@ namespace ICSharpCode.ILSpy.Debugger.Services
uint token = (uint)frame.MethodInfo.MetadataToken;
int ilOffset = frame.IP;
int line;
- TypeDefinition type;
+ MemberReference memberReference;
- if (CodeMappingsStorage.GetSourceCodeFromMetadataTokenAndOffset(frame.MethodInfo.DeclaringType.FullName, token, ilOffset, out type, out line)
- && type.DeclaringType == null) {
+ if (CodeMappingsStorage.GetSourceCodeFromMetadataTokenAndOffset(frame.MethodInfo.DeclaringType.FullName, token, ilOffset, out memberReference, out line)
+ && memberReference.DeclaringType == null) {
DebuggerService.RemoveCurrentLineMarker();
- DebuggerService.JumpToCurrentLine(type, line, 0, line, 0);
+ DebuggerService.JumpToCurrentLine(memberReference, line, 0, line, 0);
} else {
// is possible that the type is not decompiled yet, so we must do a decompilation on demand
DecompileOnDemand(frame);
@@ -885,8 +885,8 @@ namespace ICSharpCode.ILSpy.Debugger.Services
}
// try jump
int line;
- TypeDefinition type;
- if (CodeMappingsStorage.GetSourceCodeFromMetadataTokenAndOffset((nestedTypeDef ?? typeDef).FullName, token, ilOffset, out type, out line)) {
+ MemberReference memberReference;
+ if (CodeMappingsStorage.GetSourceCodeFromMetadataTokenAndOffset((nestedTypeDef ?? typeDef).FullName, token, ilOffset, out memberReference, out line)) {
DebuggerService.RemoveCurrentLineMarker();
DebuggerService.JumpToCurrentLine(typeDef, line, 0, line, 0);
} else {
diff --git a/ICSharpCode.Decompiler/CodeMappings.cs b/ICSharpCode.Decompiler/CodeMappings.cs
index 9ecd90b5f..24ce81f4d 100644
--- a/ICSharpCode.Decompiler/CodeMappings.cs
+++ b/ICSharpCode.Decompiler/CodeMappings.cs
@@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler
///
/// Maps the source code to IL.
///
- public class SourceCodeMapping
+ public sealed class SourceCodeMapping
{
///
/// Gets or sets the source code line number in the output.
@@ -83,7 +83,7 @@ namespace ICSharpCode.Decompiler
///
/// Gets or sets the type of the mapping.
///
- public TypeDefinition Type { get; internal set; }
+ public MemberReference Type { get; internal set; }
///
/// Metadata token of the method.
@@ -283,7 +283,7 @@ namespace ICSharpCode.Decompiler
string typeName,
uint token,
int ilOffset,
- out TypeDefinition type,
+ out MemberReference type,
out int line)
{
type = null;
diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs
index e24863a27..a1e30b4af 100644
--- a/ILSpy/TextView/DecompilerTextView.cs
+++ b/ILSpy/TextView/DecompilerTextView.cs
@@ -415,7 +415,8 @@ namespace ICSharpCode.ILSpy.TextView
DebugData.Language = MainWindow.Instance.sessionSettings.FilterSettings.Language.Name.StartsWith("IL") ? DecompiledLanguages.IL : DecompiledLanguages.CSharp;
if (DebugData.CurrentMember != null) {
- if (context.TreeNodes.Count() == 1) {
+ // TODO: show margin for single methods and properties
+ if (context.TreeNodes.Count() == 1 && DebugData.IsCurrentMemberType) {
iconMargin.Visibility = Visibility.Visible;
// repaint bookmarks
iconMargin.InvalidateVisual();
@@ -436,6 +437,7 @@ namespace ICSharpCode.ILSpy.TextView
} else {
// remove currentline marker
CurrentLineBookmark.Remove();
+ iconMargin.Visibility = Visibility.Collapsed;
}
}
});