From 586b5d2b0bfb153672c41b0ccf5b7cf9eb47b193 Mon Sep 17 00:00:00 2001 From: SychicBoy Date: Wed, 9 Sep 2026 13:55:58 +0330 Subject: [PATCH] Fix PDB document identity to include all document row fields --- src/DotNet/Pdb/PdbDocument.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/DotNet/Pdb/PdbDocument.cs b/src/DotNet/Pdb/PdbDocument.cs index 6f25bbe8c..1b49c9a91 100644 --- a/src/DotNet/Pdb/PdbDocument.cs +++ b/src/DotNet/Pdb/PdbDocument.cs @@ -75,6 +75,9 @@ public PdbDocument(SymbolDocument symDoc) : this(symDoc, partial: false) { if (symDoc is null) throw new ArgumentNullException(nameof(symDoc)); Url = symDoc.URL; + Language = symDoc.Language; + CheckSumAlgorithmId = symDoc.CheckSumAlgorithmId; + CheckSum = symDoc.CheckSum; if (!partial) Initialize(symDoc); } @@ -83,11 +86,8 @@ internal static PdbDocument CreatePartialForCompare(SymbolDocument symDoc) => new PdbDocument(symDoc, partial: true); internal void Initialize(SymbolDocument symDoc) { - Language = symDoc.Language; LanguageVendor = symDoc.LanguageVendor; DocumentType = symDoc.DocumentType; - CheckSumAlgorithmId = symDoc.CheckSumAlgorithmId; - CheckSum = symDoc.CheckSum; customDebugInfos = new List(); foreach (var cdi in symDoc.CustomDebugInfos) customDebugInfos.Add(cdi); @@ -113,14 +113,25 @@ public PdbDocument(string url, Guid language, Guid languageVendor, Guid document } /// - public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Url ?? string.Empty); + public override int GetHashCode() { + unchecked { + int hash = StringComparer.Ordinal.GetHashCode(Url ?? string.Empty); + hash += CheckSumAlgorithmId.GetHashCode(); + hash += Utils.GetHashCode(CheckSum); + hash += Language.GetHashCode(); + return hash; + } + } /// public override bool Equals(object obj) { var other = obj as PdbDocument; if (other is null) return false; - return StringComparer.OrdinalIgnoreCase.Equals(Url ?? string.Empty, other.Url ?? string.Empty); + return StringComparer.Ordinal.Equals(Url ?? string.Empty, other.Url ?? string.Empty) + && CheckSumAlgorithmId == other.CheckSumAlgorithmId + && Utils.Equals(CheckSum, other.CheckSum) + && Language == other.Language; } } }