Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0-staging] Fix Crossgen2 PDB generation (again) #96566

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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