public void WritePDBFile()
{
// Create the new Symbol Writer
SymbolWriter symWriter = new SymbolWriter(PEFilename, PDBFilename);
// Add each of the source documents
foreach (Document doc in _docWriters) {
doc._docWriter = symWriter.DefineDocument(
doc._file,
doc._docLanguage,
doc._langVendor,
doc._docType
);
}
// Set the entry point if it exists
if (entryPoint.GetToken() != 0)
symWriter.SetUserEntryPoint(entryPoint.GetToken());
// Loop through and add each method
foreach (Method meth in methods) {
symWriter.OpenMethod(meth.Token.GetToken());
// Write the scope and the locals
if (meth.Scope != null) WriteScopeAndLocals(symWriter, meth.Scope);
// Add each of the sequence points
foreach (Document sourceDoc in meth.SequencePointList.Keys) {
SequencePointList spList = (SequencePointList)meth.SequencePointList[sourceDoc];
symWriter.DefineSequencePoints(sourceDoc._docWriter,
(uint[])spList.offsets.ToArray(typeof(uint)),
(uint[])spList.lines.ToArray(typeof(uint)),
(uint[])spList.cols.ToArray(typeof(uint)),
(uint[])spList.endLines.ToArray(typeof(uint)),
(uint[])spList.endCols.ToArray(typeof(uint)));
}
symWriter.CloseMethod();
}
// Get the debug info
debugInfo = symWriter.GetDebugInfo();
// Close the PDB file
symWriter.Close();
}