Browse Source

Fix #3255: Ignore exceptions while decoding sequence point blobs.

pull/3265/head
Siegfried Pammer 9 months ago
parent
commit
930a4a20d1
  1. 47
      ICSharpCode.ILSpyX/PdbProvider/PortableDebugInfoProvider.cs

47
ICSharpCode.ILSpyX/PdbProvider/PortableDebugInfoProvider.cs

@ -98,31 +98,38 @@ namespace ICSharpCode.ILSpyX.PdbProvider
var debugInfo = metadata.GetMethodDebugInformation(method); var debugInfo = metadata.GetMethodDebugInformation(method);
var sequencePoints = new List<Decompiler.DebugInfo.SequencePoint>(); var sequencePoints = new List<Decompiler.DebugInfo.SequencePoint>();
foreach (var point in debugInfo.GetSequencePoints()) try
{ {
string documentFileName; foreach (var point in debugInfo.GetSequencePoints())
if (!point.Document.IsNil)
{
var document = metadata.GetDocument(point.Document);
documentFileName = metadata.GetString(document.Name);
}
else
{ {
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() { return sequencePoints;
Offset = point.Offset, }
StartLine = point.StartLine, catch (BadImageFormatException)
StartColumn = point.StartColumn, {
EndLine = point.EndLine, return EmptyList<Decompiler.DebugInfo.SequencePoint>.Instance;
EndColumn = point.EndColumn,
DocumentUrl = documentFileName
});
} }
return sequencePoints;
} }
public IList<Variable> GetVariables(MethodDefinitionHandle method) public IList<Variable> GetVariables(MethodDefinitionHandle method)

Loading…
Cancel
Save