Skip to content

Commit a1f4071

Browse files
committed
Fix the issue where PDBs generated by ILSpy do not match certain assemblies.
1 parent 55d8404 commit a1f4071

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,22 @@ string BuildFileNameFromTypeName(TypeDefinitionHandle handle)
235235

236236
if (pdbId == null)
237237
{
238-
var debugDir = file.Reader.ReadDebugDirectory().FirstOrDefault(dir => dir.Type == DebugDirectoryEntryType.CodeView);
238+
DebugDirectoryEntry debugDir = default;
239+
foreach (var dir in file.Reader.ReadDebugDirectory())
240+
{
241+
if (dir.Type == DebugDirectoryEntryType.CodeView)
242+
{
243+
if (debugDir.Equals(default(DebugDirectoryEntry)))
244+
{
245+
debugDir = dir;
246+
}
247+
if (dir.IsPortableCodeView)
248+
{
249+
debugDir = dir;
250+
break;
251+
}
252+
}
253+
}
239254
var portable = file.Reader.ReadCodeViewDebugDirectoryData(debugDir);
240255
pdbId = new BlobContentId(portable.Guid, debugDir.Stamp);
241256
}

0 commit comments

Comments
 (0)