From 45081a6c4e7b38c98744f17ef141c7c40b5918d8 Mon Sep 17 00:00:00 2001 From: sonyps5201314 Date: Tue, 2 Dec 2025 02:37:47 +0800 Subject: [PATCH] Fix the issue where PDBs generated by ILSpy do not match certain assemblies. --- ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs b/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs index f1636dbaf..bc3c2c23a 100644 --- a/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs +++ b/ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs @@ -235,8 +235,9 @@ namespace ICSharpCode.Decompiler.DebugInfo if (pdbId == null) { - var debugDir = file.Reader.ReadDebugDirectory().FirstOrDefault(dir => dir.Type == DebugDirectoryEntryType.CodeView); + var debugDir = file.Reader.ReadDebugDirectory().LastOrDefault(dir => dir.Type == DebugDirectoryEntryType.CodeView); var portable = file.Reader.ReadCodeViewDebugDirectoryData(debugDir); + Debug.Assert(!portable.Path.EndsWith(".ni.pdb")); pdbId = new BlobContentId(portable.Guid, debugDir.Stamp); }