Skip to content

Commit

Permalink
[release/8.0-staging] Fix Crossgen2 PDB generation (again) (#96566)
Browse files Browse the repository at this point in the history
* Fix Crossgen2 PDB generation (again)

* Simplify the change per JanK's PR feedback

---------

Co-authored-by: Tomáš Rylek <trylek@microsoft.com>
  • Loading branch information
github-actions[bot] and trylek authored Jan 16, 2024
1 parent a5fc8ff commit f9d0a7b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/coreclr/tools/aot/ILCompiler.Diagnostics/PdbWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ public void WritePDBData(string dllPath, IEnumerable<MethodInfo> methods)
}
finally
{
if ((_ngenWriter != null) && (_pdbMod != UIntPtr.Zero))
if (_ngenWriter != null)
{
_ngenWriter.CloseMod(_pdbMod);
if (_pdbMod != UIntPtr.Zero)
{
_ngenWriter.CloseMod(_pdbMod);
}
ComObject ngenWriterComObject = (ComObject)(object)_ngenWriter;
ngenWriterComObject.FinalRelease();
}
}

Expand Down Expand Up @@ -211,6 +216,7 @@ private void WritePDBDataHelper(string dllPath, IEnumerable<MethodInfo> methods)
var comWrapper = new StrategyBasedComWrappers();
CreateNGenPdbWriter(dllPath, _pdbFilePath, out var pdbWriterInst);
_ngenWriter = (ISymNGenWriter2)comWrapper.GetOrCreateObjectForComInstance(pdbWriterInst, CreateObjectFlags.UniqueInstance);
Marshal.Release(pdbWriterInst);

{
// PDB file is now created. Get its path and update _pdbFilePath so the PDB file
Expand Down

0 comments on commit f9d0a7b

Please sign in to comment.