Skip to content

Commit d5b5aac

Browse files
authored
fix: System.Reflection.Metadata.Document.Name can throw BadImageForma… (#10410)
fix: System.Reflection.Metadata.Document.Name can throw BadImageFormatException
1 parent 872fdb3 commit d5b5aac

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: src/Docfx.Dotnet/SymbolUrlResolver.SourceLink.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,15 @@ public SourceLinkProvider(PEReader peReader, MetadataReaderProvider pdbReaderPro
8989
private string? TryGetSourceLinkUrl(DocumentHandle handle)
9090
{
9191
var document = _pdbReader.GetDocument(handle);
92-
if (document.Name.IsNil)
92+
try
93+
{
94+
if (document.Name.IsNil)
95+
return null;
96+
}
97+
catch (BadImageFormatException)
98+
{
9399
return null;
100+
}
94101

95102
var documentName = _pdbReader.GetString(document.Name);
96103
if (documentName is null)

0 commit comments

Comments
 (0)