Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,10 @@ public IEnumerable<NativeSequencePoint> GetNativeSequencePoints()
if (_debugLocInfos == null)
yield break;

var sequencePoints = new (string Document, int LineNumber)[_debugLocInfos.Length * 4 /* chosen empirically */];
var sequencePoints = new (string Document, int LineNumber, bool IsBackedSequencePoint)[_debugLocInfos.Length * 4 /* chosen empirically */];
try
{
int maxOffset = 0;
foreach (var sequencePoint in _debugInfo.GetSequencePoints())
{
int offset = sequencePoint.Offset;
Expand All @@ -271,8 +272,19 @@ public IEnumerable<NativeSequencePoint> GetNativeSequencePoints()
int newLength = Math.Max(2 * sequencePoints.Length, sequencePoint.Offset + 1);
Array.Resize(ref sequencePoints, newLength);
}
sequencePoints[offset] = (sequencePoint.Document, sequencePoint.LineNumber);
sequencePoints[offset] = (sequencePoint.Document, sequencePoint.LineNumber, true);
maxOffset = Math.Max(maxOffset, offset);
}

for (int i = 1; i <= maxOffset; i++)
{
if (sequencePoints[i].Document == null && sequencePoints[i - 1].Document != null)
{
sequencePoints[i] = (sequencePoints[i - 1].Document, sequencePoints[i - 1].LineNumber, false);
}
}
Comment thread
rcj1 marked this conversation as resolved.


Comment thread
rcj1 marked this conversation as resolved.
Outdated
}
catch (BadImageFormatException)
{
Expand All @@ -283,6 +295,7 @@ public IEnumerable<NativeSequencePoint> GetNativeSequencePoints()
}

int previousNativeOffset = -1;
int previousIlOffset = -1;
foreach (var nativeMapping in _debugLocInfos)
{
if (nativeMapping.NativeOffset == previousNativeOffset)
Expand All @@ -291,13 +304,15 @@ public IEnumerable<NativeSequencePoint> GetNativeSequencePoints()
if (nativeMapping.ILOffset < sequencePoints.Length)
{
var sequencePoint = sequencePoints[nativeMapping.ILOffset];
if (sequencePoint.Document != null)
if ((sequencePoint.IsBackedSequencePoint || nativeMapping.ILOffset < previousIlOffset) &&
sequencePoint.Document != null)
Comment thread
rcj1 marked this conversation as resolved.
{
yield return new NativeSequencePoint(
nativeMapping.NativeOffset,
sequencePoint.Document,
sequencePoint.LineNumber);
previousNativeOffset = nativeMapping.NativeOffset;
previousIlOffset = nativeMapping.ILOffset;
}
}
}
Expand Down
Loading