From 44ad1a3c2fd4c35cdbd2d4eb599c34bb564501ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 18:09:53 +0000 Subject: [PATCH 1/9] Initial plan From 9d17e8898cda7fec3ad76531b901424e84713189 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 18:14:57 +0000 Subject: [PATCH 2/9] Flush R2R object stream before generating native PDB The FileStream that ReadyToRunObjectWriter writes the R2R image into was kept open (via a method-scoped `using`) while SymbolFileBuilder.SavePdb read the image back from disk to generate the native PDB. Because the FileStream buffers writes until disposed, the PDB writer could observe an incomplete image with a zeroed CodeView/RSDS GUID, producing native PDBs whose PDB-info GUID did not match the DLL. Close the stream (capturing the file size for the map builder) before generating symbol files. Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../CodeGen/ReadyToRunObjectWriter.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs index c83fce292bf3f0..7f8156d59159a1 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs @@ -187,8 +187,15 @@ public void EmitReadyToRunObjects(ReadyToRunContainerFormat format, Logger logge _ => throw new UnreachableException() }; - using FileStream stream = new FileStream(_objectFilePath, FileMode.Create); - objectWriter.EmitObject(stream, _nodes, dumper: null, logger); + long outputFileSize; + // Close and flush the output stream before generating symbol files (PDB / PerfMap), + // which read the finished image back from disk. Leaving the stream open here would + // let the PDB writer observe an incomplete file (e.g. a zeroed CodeView/RSDS GUID). + using (FileStream stream = new FileStream(_objectFilePath, FileMode.Create)) + { + objectWriter.EmitObject(stream, _nodes, dumper: null, logger); + outputFileSize = stream.Length; + } if (_outputInfoBuilder is not null) { @@ -198,7 +205,7 @@ public void EmitReadyToRunObjects(ReadyToRunContainerFormat format, Logger logge if (_mapFileBuilder != null) { - _mapFileBuilder.SetFileSize(stream.Length); + _mapFileBuilder.SetFileSize(outputFileSize); } if (_outputInfoBuilder is not null) From ff57ec5c876052fe70a2f9acd8d4b27a8048666c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 19:09:20 +0000 Subject: [PATCH 3/9] Validate PDB/image identity match in PdbChecker Extend PdbChecker to optionally take the crossgen2 output image via a new `--image ` argument. When supplied, it reads the image's CodeView/RSDS debug record and verifies the DIA-reported PDB-info GUID/age is nonzero and matches the image identity, regressing the zero-GUID native PDB bug. Wire the crossgen2 R2R test PDB check to pass the output image. Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../tools/PdbChecker/MSDiaSymbolReader.cs | 16 +++ src/coreclr/tools/PdbChecker/Program.cs | 97 ++++++++++++++++++- src/tests/Common/CLRTest.CrossGen.targets | 2 +- 3 files changed, 109 insertions(+), 6 deletions(-) diff --git a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs index ddea0a5ef01743..59f6adb1c67552 100644 --- a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs +++ b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs @@ -32,6 +32,16 @@ void CreateInstance([MarshalAs(UnmanagedType.Interface)] object? aggregator, private readonly List _pdbSymbols; + /// + /// PDB-info identity GUID as reported by DIA for the PDB file. + /// + public Guid PdbGuid { get; } + + /// + /// PDB-info age as reported by DIA for the PDB file. + /// + public uint PdbAge { get; } + public MSDiaSymbolReader(string pdbFile) { try @@ -44,6 +54,10 @@ public MSDiaSymbolReader(string pdbFile) _diaDataSource.loadDataFromPdb(pdbFile); _diaDataSource.openSession(out _diaSession); + IDiaSymbol globalScope = _diaSession.globalScope; + PdbGuid = globalScope.guid; + PdbAge = globalScope.age; + _pdbSymbols = new List(); _diaSession.getSymbolsByAddr(out IDiaEnumSymbolsByAddr symbolEnum); @@ -58,6 +72,8 @@ public MSDiaSymbolReader(string pdbFile) } Console.WriteLine("PDB file: {0}", pdbFile); + Console.WriteLine("PDB GUID: {0}", PdbGuid); + Console.WriteLine("PDB age: {0}", PdbAge); Console.WriteLine("Total symbols: {0}", symbolsTotal); Console.WriteLine("Public symbols: {0}", _pdbSymbols.Count); } diff --git a/src/coreclr/tools/PdbChecker/Program.cs b/src/coreclr/tools/PdbChecker/Program.cs index 41f4209ce648dc..f1d90c7ce1d3de 100644 --- a/src/coreclr/tools/PdbChecker/Program.cs +++ b/src/coreclr/tools/PdbChecker/Program.cs @@ -1,7 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection.PortableExecutable; using Dia2Lib; class Program { @@ -26,12 +29,49 @@ private static void TryMain(string[] args) DisplayUsage(); return; } - MSDiaSymbolReader reader = new MSDiaSymbolReader(args[0]); + + string? pdbFile = null; + string? imageFile = null; + List symbolNames = new List(); + + for (int argIndex = 0; argIndex < args.Length; argIndex++) + { + string arg = args[argIndex]; + if (arg.Equals("--image", StringComparison.OrdinalIgnoreCase)) + { + if (++argIndex >= args.Length) + { + throw new Exception("Missing image file path after --image"); + } + imageFile = args[argIndex]; + } + else if (pdbFile is null) + { + pdbFile = arg; + } + else + { + symbolNames.Add(arg); + } + } + + if (pdbFile is null) + { + DisplayUsage(); + return; + } + + MSDiaSymbolReader reader = new MSDiaSymbolReader(pdbFile); + + if (imageFile is not null) + { + ValidatePdbMatchesImage(reader, imageFile); + } + int matchedSymbols = 0; int missingSymbols = 0; - for (int symbolArgIndex = 1; symbolArgIndex < args.Length; symbolArgIndex++) + foreach (string symbolName in symbolNames) { - string symbolName = args[symbolArgIndex]; if (reader.ContainsSymbol(symbolName)) { matchedSymbols++; @@ -53,8 +93,55 @@ private static void TryMain(string[] args) } } + /// + /// Verify that the PDB carries a nonzero PDB-info identity and that its GUID and age + /// match the CodeView / RSDS debug record embedded in the output image. This guards + /// against native PDBs whose identity does not satisfy the image's symbol-server lookup key. + /// + private static void ValidatePdbMatchesImage(MSDiaSymbolReader reader, string imageFile) + { + CodeViewDebugDirectoryData codeViewData = default; + bool hasCodeView = false; + using (FileStream imageStream = File.OpenRead(imageFile)) + using (PEReader peReader = new PEReader(imageStream)) + { + foreach (DebugDirectoryEntry entry in peReader.ReadDebugDirectory()) + { + if (entry.Type == DebugDirectoryEntryType.CodeView) + { + codeViewData = peReader.ReadCodeViewDebugDirectoryData(entry); + hasCodeView = true; + break; + } + } + } + + Console.WriteLine("Image file: {0}", imageFile); + + if (!hasCodeView) + { + throw new Exception($"Image file {imageFile} does not contain a CodeView (RSDS) debug directory entry"); + } + + Console.WriteLine("Image GUID: {0}", codeViewData.Guid); + Console.WriteLine("Image age: {0}", codeViewData.Age); + + if (reader.PdbGuid == Guid.Empty) + { + throw new Exception($"PDB-info GUID is all zero; it cannot satisfy the symbol-server lookup key of image {imageFile}"); + } + + if (reader.PdbGuid != codeViewData.Guid || reader.PdbAge != codeViewData.Age) + { + throw new Exception( + $"PDB-info identity {reader.PdbGuid}/{reader.PdbAge} does not match image CodeView identity {codeViewData.Guid}/{codeViewData.Age}"); + } + + Console.WriteLine("PDB identity matches image CodeView identity: {0}/{1}", reader.PdbGuid, reader.PdbAge); + } + private static void DisplayUsage() { - Console.WriteLine("Usage: PdbChecker { }"); + Console.WriteLine("Usage: PdbChecker [--image ] { }"); } } diff --git a/src/tests/Common/CLRTest.CrossGen.targets b/src/tests/Common/CLRTest.CrossGen.targets index 8da1a085b5ab0c..98ef6dca7685df 100644 --- a/src/tests/Common/CLRTest.CrossGen.targets +++ b/src/tests/Common/CLRTest.CrossGen.targets @@ -402,7 +402,7 @@ if defined RunCrossGen2 ( if defined CrossGen2TestCheckPdb ( set __CheckPdbCommand=!__DotNet! set __CheckPdbCommand=!__CheckPdbCommand! "!CORE_ROOT!\PdbChecker\PdbChecker.dll" - set __CheckPdbCommand=!__CheckPdbCommand! !__PdbFile! @(CheckPdbSymbol->'%22%(Identity)%22', ' ') + set __CheckPdbCommand=!__CheckPdbCommand! !__PdbFile! --image !__OutputFile! @(CheckPdbSymbol->'%22%(Identity)%22', ' ') echo "!__CheckPdbCommand!" call !__CheckPdbCommand! if not !ERRORLEVEL!==0 ( From 631b0c04fd071a74174c11506d9eb1edab90f64d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 19:10:08 +0000 Subject: [PATCH 4/9] PdbChecker: error when --image is given without a PDB file Avoid silently skipping validation and returning success when a PDB file argument is omitted but --image is supplied. Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- src/coreclr/tools/PdbChecker/Program.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreclr/tools/PdbChecker/Program.cs b/src/coreclr/tools/PdbChecker/Program.cs index f1d90c7ce1d3de..4dba425ab90a6a 100644 --- a/src/coreclr/tools/PdbChecker/Program.cs +++ b/src/coreclr/tools/PdbChecker/Program.cs @@ -57,6 +57,10 @@ private static void TryMain(string[] args) if (pdbFile is null) { + if (imageFile is not null) + { + throw new Exception("Missing PDB file argument"); + } DisplayUsage(); return; } From 5ea29ef41dc9b2996c26d16ea766bf2ebf2c048f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 20:05:16 +0000 Subject: [PATCH 5/9] PdbChecker: require pdb as args[0] and validate via loadAndValidateDataFromPdb Keep the PDB file as the first positional argument. When --image is supplied, MSDiaSymbolReader reads the image's CodeView/RSDS identity and loads the PDB via DIA's loadAndValidateDataFromPdb, which throws when the PDB-info GUID/age don't match the image (including the all-zero GUID regression), instead of comparing identities manually in Program.cs. Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../tools/PdbChecker/MSDiaSymbolReader.cs | 40 +++++++++- src/coreclr/tools/PdbChecker/Program.cs | 76 ++----------------- 2 files changed, 43 insertions(+), 73 deletions(-) diff --git a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs index 59f6adb1c67552..e822b4c4d77ede 100644 --- a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs +++ b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Reflection.PortableExecutable; using System.Runtime.InteropServices; using Dia2Lib; @@ -42,7 +43,7 @@ void CreateInstance([MarshalAs(UnmanagedType.Interface)] object? aggregator, /// public uint PdbAge { get; } - public MSDiaSymbolReader(string pdbFile) + public MSDiaSymbolReader(string pdbFile, string? imageFile = null) { try { @@ -51,7 +52,23 @@ public MSDiaSymbolReader(string pdbFile) diaClassFactory.CreateInstance(null, typeof(IDiaDataSource).GetTypeInfo().GUID, out object comObject); _diaDataSource = (IDiaDataSource)comObject; - _diaDataSource.loadDataFromPdb(pdbFile); + + if (imageFile is not null) + { + // Validate the PDB against the image's CodeView / RSDS identity. DIA throws if the + // PDB-info GUID / age don't match the image (e.g. an all-zero GUID native PDB), + // which is exactly the regression this check guards against. + (Guid imageGuid, uint imageAge) = ReadImageCodeViewIdentity(imageFile); + Console.WriteLine("Image file: {0}", imageFile); + Console.WriteLine("Image GUID: {0}", imageGuid); + Console.WriteLine("Image age: {0}", imageAge); + _diaDataSource.loadAndValidateDataFromPdb(pdbFile, ref imageGuid, 0, imageAge); + } + else + { + _diaDataSource.loadDataFromPdb(pdbFile); + } + _diaDataSource.openSession(out _diaSession); IDiaSymbol globalScope = _diaSession.globalScope; @@ -83,6 +100,25 @@ public MSDiaSymbolReader(string pdbFile) } } + /// + /// Read the CodeView / RSDS debug record identity (GUID and age) from a PE image. + /// + private static (Guid Guid, uint Age) ReadImageCodeViewIdentity(string imageFile) + { + using FileStream imageStream = File.OpenRead(imageFile); + using PEReader peReader = new PEReader(imageStream); + foreach (DebugDirectoryEntry entry in peReader.ReadDebugDirectory()) + { + if (entry.Type == DebugDirectoryEntryType.CodeView) + { + CodeViewDebugDirectoryData codeViewData = peReader.ReadCodeViewDebugDirectoryData(entry); + return (codeViewData.Guid, (uint)codeViewData.Age); + } + } + + throw new Exception($"Image file {imageFile} does not contain a CodeView (RSDS) debug directory entry"); + } + public void DumpSymbols() { Console.WriteLine("PDB public symbol list:"); diff --git a/src/coreclr/tools/PdbChecker/Program.cs b/src/coreclr/tools/PdbChecker/Program.cs index 4dba425ab90a6a..a61565d17cd6d2 100644 --- a/src/coreclr/tools/PdbChecker/Program.cs +++ b/src/coreclr/tools/PdbChecker/Program.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using System.IO; -using System.Reflection.PortableExecutable; using Dia2Lib; class Program { @@ -30,11 +28,11 @@ private static void TryMain(string[] args) return; } - string? pdbFile = null; + string pdbFile = args[0]; string? imageFile = null; List symbolNames = new List(); - for (int argIndex = 0; argIndex < args.Length; argIndex++) + for (int argIndex = 1; argIndex < args.Length; argIndex++) { string arg = args[argIndex]; if (arg.Equals("--image", StringComparison.OrdinalIgnoreCase)) @@ -45,32 +43,15 @@ private static void TryMain(string[] args) } imageFile = args[argIndex]; } - else if (pdbFile is null) - { - pdbFile = arg; - } else { symbolNames.Add(arg); } } - if (pdbFile is null) - { - if (imageFile is not null) - { - throw new Exception("Missing PDB file argument"); - } - DisplayUsage(); - return; - } - - MSDiaSymbolReader reader = new MSDiaSymbolReader(pdbFile); - - if (imageFile is not null) - { - ValidatePdbMatchesImage(reader, imageFile); - } + // When an image is provided, MSDiaSymbolReader validates that the PDB-info identity + // matches the image's CodeView / RSDS record, guarding against the zero-GUID native PDB bug. + MSDiaSymbolReader reader = new MSDiaSymbolReader(pdbFile, imageFile); int matchedSymbols = 0; int missingSymbols = 0; @@ -97,53 +78,6 @@ private static void TryMain(string[] args) } } - /// - /// Verify that the PDB carries a nonzero PDB-info identity and that its GUID and age - /// match the CodeView / RSDS debug record embedded in the output image. This guards - /// against native PDBs whose identity does not satisfy the image's symbol-server lookup key. - /// - private static void ValidatePdbMatchesImage(MSDiaSymbolReader reader, string imageFile) - { - CodeViewDebugDirectoryData codeViewData = default; - bool hasCodeView = false; - using (FileStream imageStream = File.OpenRead(imageFile)) - using (PEReader peReader = new PEReader(imageStream)) - { - foreach (DebugDirectoryEntry entry in peReader.ReadDebugDirectory()) - { - if (entry.Type == DebugDirectoryEntryType.CodeView) - { - codeViewData = peReader.ReadCodeViewDebugDirectoryData(entry); - hasCodeView = true; - break; - } - } - } - - Console.WriteLine("Image file: {0}", imageFile); - - if (!hasCodeView) - { - throw new Exception($"Image file {imageFile} does not contain a CodeView (RSDS) debug directory entry"); - } - - Console.WriteLine("Image GUID: {0}", codeViewData.Guid); - Console.WriteLine("Image age: {0}", codeViewData.Age); - - if (reader.PdbGuid == Guid.Empty) - { - throw new Exception($"PDB-info GUID is all zero; it cannot satisfy the symbol-server lookup key of image {imageFile}"); - } - - if (reader.PdbGuid != codeViewData.Guid || reader.PdbAge != codeViewData.Age) - { - throw new Exception( - $"PDB-info identity {reader.PdbGuid}/{reader.PdbAge} does not match image CodeView identity {codeViewData.Guid}/{codeViewData.Age}"); - } - - Console.WriteLine("PDB identity matches image CodeView identity: {0}/{1}", reader.PdbGuid, reader.PdbAge); - } - private static void DisplayUsage() { Console.WriteLine("Usage: PdbChecker [--image ] { }"); From d013216597e819655a114cfab7a5a0b4902c8841 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 20:06:04 +0000 Subject: [PATCH 6/9] PdbChecker: document sig=0 for RSDS (PDB 7.0) validation Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs index e822b4c4d77ede..20f9f9ed5f47e4 100644 --- a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs +++ b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs @@ -62,6 +62,8 @@ public MSDiaSymbolReader(string pdbFile, string? imageFile = null) Console.WriteLine("Image file: {0}", imageFile); Console.WriteLine("Image GUID: {0}", imageGuid); Console.WriteLine("Image age: {0}", imageAge); + // sig is 0: R2R images use the RSDS (PDB 7.0) CodeView record, whose identity is the + // GUID + age only; the legacy NB10 32-bit signature does not apply. _diaDataSource.loadAndValidateDataFromPdb(pdbFile, ref imageGuid, 0, imageAge); } else From 809f5c6499a7f369264a3dca535c8e66e373d913 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Jul 2026 20:29:16 +0000 Subject: [PATCH 7/9] Remove PdbGuid/PdbAge properties from MSDiaSymbolReader, use locals Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../tools/PdbChecker/MSDiaSymbolReader.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs index 20f9f9ed5f47e4..9a40099f3040df 100644 --- a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs +++ b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs @@ -33,16 +33,6 @@ void CreateInstance([MarshalAs(UnmanagedType.Interface)] object? aggregator, private readonly List _pdbSymbols; - /// - /// PDB-info identity GUID as reported by DIA for the PDB file. - /// - public Guid PdbGuid { get; } - - /// - /// PDB-info age as reported by DIA for the PDB file. - /// - public uint PdbAge { get; } - public MSDiaSymbolReader(string pdbFile, string? imageFile = null) { try @@ -74,8 +64,8 @@ public MSDiaSymbolReader(string pdbFile, string? imageFile = null) _diaDataSource.openSession(out _diaSession); IDiaSymbol globalScope = _diaSession.globalScope; - PdbGuid = globalScope.guid; - PdbAge = globalScope.age; + Guid pdbGuid = globalScope.guid; + uint pdbAge = globalScope.age; _pdbSymbols = new List(); @@ -91,8 +81,8 @@ public MSDiaSymbolReader(string pdbFile, string? imageFile = null) } Console.WriteLine("PDB file: {0}", pdbFile); - Console.WriteLine("PDB GUID: {0}", PdbGuid); - Console.WriteLine("PDB age: {0}", PdbAge); + Console.WriteLine("PDB GUID: {0}", pdbGuid); + Console.WriteLine("PDB age: {0}", pdbAge); Console.WriteLine("Total symbols: {0}", symbolsTotal); Console.WriteLine("Public symbols: {0}", _pdbSymbols.Count); } From 527c23544d309b17418a427aa001d7e597b6e3a3 Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Thu, 30 Jul 2026 14:09:12 -0700 Subject: [PATCH 8/9] Apply batched suggestions from code review Co-authored-by: Elinor Fung --- src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs index 9a40099f3040df..f22976a46657dc 100644 --- a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs +++ b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs @@ -46,8 +46,7 @@ public MSDiaSymbolReader(string pdbFile, string? imageFile = null) if (imageFile is not null) { // Validate the PDB against the image's CodeView / RSDS identity. DIA throws if the - // PDB-info GUID / age don't match the image (e.g. an all-zero GUID native PDB), - // which is exactly the regression this check guards against. + // PDB-info GUID / age don't match the image (Guid imageGuid, uint imageAge) = ReadImageCodeViewIdentity(imageFile); Console.WriteLine("Image file: {0}", imageFile); Console.WriteLine("Image GUID: {0}", imageGuid); @@ -63,10 +62,6 @@ public MSDiaSymbolReader(string pdbFile, string? imageFile = null) _diaDataSource.openSession(out _diaSession); - IDiaSymbol globalScope = _diaSession.globalScope; - Guid pdbGuid = globalScope.guid; - uint pdbAge = globalScope.age; - _pdbSymbols = new List(); _diaSession.getSymbolsByAddr(out IDiaEnumSymbolsByAddr symbolEnum); @@ -82,7 +77,10 @@ public MSDiaSymbolReader(string pdbFile, string? imageFile = null) Console.WriteLine("PDB file: {0}", pdbFile); Console.WriteLine("PDB GUID: {0}", pdbGuid); - Console.WriteLine("PDB age: {0}", pdbAge); + IDiaSymbol globalScope = _diaSession.globalScope; + Console.WriteLine("PDB file: {0}", pdbFile); + Console.WriteLine("PDB GUID: {0}", globalScope.guid); + Console.WriteLine("PDB age: {0}", globalScope.age); Console.WriteLine("Total symbols: {0}", symbolsTotal); Console.WriteLine("Public symbols: {0}", _pdbSymbols.Count); } From a9e5f688332a5a043842d13042b7614cc6672a3e Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Thu, 30 Jul 2026 14:27:11 -0700 Subject: [PATCH 9/9] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs index f22976a46657dc..29c525622afb19 100644 --- a/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs +++ b/src/coreclr/tools/PdbChecker/MSDiaSymbolReader.cs @@ -75,8 +75,6 @@ public MSDiaSymbolReader(string pdbFile, string? imageFile = null) } } - Console.WriteLine("PDB file: {0}", pdbFile); - Console.WriteLine("PDB GUID: {0}", pdbGuid); IDiaSymbol globalScope = _diaSession.globalScope; Console.WriteLine("PDB file: {0}", pdbFile); Console.WriteLine("PDB GUID: {0}", globalScope.guid);