diff --git a/Debugger/Debugger.Core/SourcecodeSegment.cs b/Debugger/Debugger.Core/SourcecodeSegment.cs
index baacddacc..459d34451 100644
--- a/Debugger/Debugger.Core/SourcecodeSegment.cs
+++ b/Debugger/Debugger.Core/SourcecodeSegment.cs
@@ -383,7 +383,7 @@ namespace Debugger
segment.endColumn = 0;
segment.corFunction = corFunction;
segment.ilStart = offset;
- segment.ilEnd = ranges[ranges.Length - 1];
+ segment.ilEnd = ranges[1];
segment.stepRanges = ranges;
return segment;
diff --git a/Debugger/Debugger.Core/StackFrame.cs b/Debugger/Debugger.Core/StackFrame.cs
index 75be28c06..9a8d0f9e3 100644
--- a/Debugger/Debugger.Core/StackFrame.cs
+++ b/Debugger/Debugger.Core/StackFrame.cs
@@ -191,13 +191,8 @@ namespace Debugger
void AsyncStep(bool stepIn)
{
- SourcecodeSegment nextSt = NextStatement;
- if (nextSt == null) {
- throw new DebuggerException("Unable to step. Next statement not aviable");
- }
-
if (stepIn) {
- Stepper stepInStepper = Stepper.StepIn(this, nextSt.StepRanges, "normal");
+ Stepper stepInStepper = Stepper.StepIn(this, ILRanges, "normal");
this.Thread.CurrentStepIn = stepInStepper;
Stepper clearCurrentStepIn = Stepper.StepOut(this, "clear current step in");
clearCurrentStepIn.StepComplete += delegate {
@@ -207,7 +202,7 @@ namespace Debugger
};
clearCurrentStepIn.Ignore = true;
} else {
- Stepper.StepOver(this, nextSt.StepRanges, "normal");
+ Stepper.StepOver(this, ILRanges, "normal");
}
AsyncContinue();
diff --git a/ICSharpCode.Decompiler/CodeMappings.cs b/ICSharpCode.Decompiler/CodeMappings.cs
index 366db3c56..b5843df9a 100644
--- a/ICSharpCode.Decompiler/CodeMappings.cs
+++ b/ICSharpCode.Decompiler/CodeMappings.cs
@@ -45,24 +45,19 @@ namespace ICSharpCode.Decompiler
///
public int[] ToArray()
{
- var resultList = new List();
-
// add list for the current source code line
var currentList = MemberMapping.MemberCodeMappings
.FindAll(m => m.SourceCodeLine == this.SourceCodeLine)
- .OrderBy(m => m.ILInstructionOffset.From);
- foreach (var element in currentList.Distinct(new SourceCodeMappingComparer())) {
- resultList.Add(element.ILInstructionOffset.From);
- resultList.Add(element.ILInstructionOffset.To);
- }
+ .ConvertAll(m => m.ILInstructionOffset);
+
// add inverted
- var invertedList = MemberMapping.GetInvertedList();
- if (invertedList != null && invertedList.Count() > 0) {
- foreach (var range in invertedList) {
- resultList.Add(range.From);
- resultList.Add(range.To);
- }
+ currentList.AddRange(MemberMapping.GetInvertedList());
+
+ var resultList = new List();
+ foreach (var element in ILRange.OrderAndJoint(currentList)) {
+ resultList.Add(element.From);
+ resultList.Add(element.To);
}
return resultList.ToArray();