Skip to content

Commit

Permalink
Fix #3255: Ignore exceptions while decoding sequence point blobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Aug 17, 2024
1 parent 39d5deb commit 930a4a2
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions ICSharpCode.ILSpyX/PdbProvider/PortableDebugInfoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,38 @@ public string Description {
var debugInfo = metadata.GetMethodDebugInformation(method);
var sequencePoints = new List<Decompiler.DebugInfo.SequencePoint>();

foreach (var point in debugInfo.GetSequencePoints())
try
{
string documentFileName;

if (!point.Document.IsNil)
{
var document = metadata.GetDocument(point.Document);
documentFileName = metadata.GetString(document.Name);
}
else
foreach (var point in debugInfo.GetSequencePoints())
{
documentFileName = "";
string documentFileName;

if (!point.Document.IsNil)
{
var document = metadata.GetDocument(point.Document);
documentFileName = metadata.GetString(document.Name);
}
else
{
documentFileName = "";
}

sequencePoints.Add(new Decompiler.DebugInfo.SequencePoint() {
Offset = point.Offset,
StartLine = point.StartLine,
StartColumn = point.StartColumn,
EndLine = point.EndLine,
EndColumn = point.EndColumn,
DocumentUrl = documentFileName
});
}

sequencePoints.Add(new Decompiler.DebugInfo.SequencePoint() {
Offset = point.Offset,
StartLine = point.StartLine,
StartColumn = point.StartColumn,
EndLine = point.EndLine,
EndColumn = point.EndColumn,
DocumentUrl = documentFileName
});
return sequencePoints;
}
catch (BadImageFormatException)
{
return EmptyList<Decompiler.DebugInfo.SequencePoint>.Instance;
}

return sequencePoints;
}

public IList<Variable> GetVariables(MethodDefinitionHandle method)
Expand Down

0 comments on commit 930a4a2

Please sign in to comment.