public void CloseTokenSourceLocationsScope() { if (this.symWriter5 != null) { this.symWriter5.CloseMapTokensToSourceSpans(); } this.symWriter5 = null; }
public void WriteDefinitionLocations(PeWriter peWriter, MultiDictionary <Cci.DebugSourceDocument, Cci.DefinitionWithLocation> file2definitions) { ISymUnmanagedWriter5 writer5 = this.symWriter as ISymUnmanagedWriter5; if ((object)writer5 != null) { // NOTE: ISymUnmanagedWriter5 reports HRESULT = 0x806D000E in case we open and close // the map without writing any resords with MapTokenToSourceSpan(...) bool open = false; foreach (var doc in file2definitions.Keys) { ISymUnmanagedDocumentWriter docWriter = GetDocumentWriter(doc); foreach (var definition in file2definitions[doc]) { if (!open) { try { writer5.OpenMapTokensToSourceSpans(); } catch (Exception ex) { throw new PdbWritingException(ex); } open = true; } uint token = peWriter.GetTokenForDefinition(definition.Definition); Debug.Assert(token != 0); try { writer5.MapTokenToSourceSpan(token, docWriter, definition.StartLine + 1, definition.StartColumn + 1, definition.EndLine + 1, definition.EndColumn + 1); } catch (Exception ex) { throw new PdbWritingException(ex); } } } if (open) { try { writer5.CloseMapTokensToSourceSpans(); } catch (Exception ex) { throw new PdbWritingException(ex); } } } }
internal SymUnmanagedWriterImpl(ComMemoryStream pdbStream, ISymUnmanagedWriter5 symWriter, string symWriterModuleName) { Debug.Assert(pdbStream != null); Debug.Assert(symWriter != null); Debug.Assert(symWriterModuleName != null); _pdbStream = pdbStream; _symWriter = symWriter; _documentWriters = new List <ISymUnmanagedDocumentWriter>(); _symWriterModuleName = symWriterModuleName; }
public void SetMetadataEmitter(object metadataEmitter) { Type t = Type.GetTypeFromProgID("CorSymWriter_SxS", false); if (t != null) { this.symWriter = (ISymUnmanagedWriter2)Activator.CreateInstance(t); this.symWriter.Initialize(metadataEmitter, this.fileName, null, true); if (this.emitTokenSourceInfo) { this.symWriter5 = this.symWriter as ISymUnmanagedWriter5; } } }
public void SetMetadataEmitter(object metadataEmitter) { object symWriterObject = CoCreateInstance( ref CLSID_CorSymWriter_SxS, IntPtr.Zero, CLSCTX_INPROC_SERVER, ref IID_ISymUnmanagedWriter2); if (symWriterObject != null) { this.symWriter = (ISymUnmanagedWriter2)symWriterObject; this.symWriter.Initialize(metadataEmitter, this.fileName, null, true); if (this.emitTokenSourceInfo) { this.symWriter5 = this.symWriter as ISymUnmanagedWriter5; } } }
public void SetMetadataEmitter(MetadataWriter metadataWriter) { try { var symWriter = (ISymUnmanagedWriter5)(_symWriterFactory != null ? _symWriterFactory() : CreateSymWriterWorker()); // Correctness: If the stream is not specified or if it is non-empty the SymWriter appends data to it (provided it contains valid PDB) // and the resulting PDB has Age = existing_age + 1. _pdbStream = new ComMemoryStream(); if (_deterministic) { if (!(symWriter is ISymUnmanagedWriter7)) { throw new NotSupportedException(CodeAnalysisResources.SymWriterNotDeterministic); } ((ISymUnmanagedWriter7)symWriter).InitializeDeterministic(new PdbMetadataWrapper(metadataWriter), _pdbStream); } else { symWriter.Initialize(new PdbMetadataWrapper(metadataWriter), _fileName, _pdbStream, fullBuild: true); } _metadataWriter = metadataWriter; _symWriter = symWriter; } catch (Exception ex) { throw new PdbWritingException(ex); } }
private void Close() { try { _symWriter?.Close(); _symWriter = null; _pdbStream = null; } catch (Exception ex) { throw new PdbWritingException(ex); } }
public unsafe void WriteTo(Stream stream) { Debug.Assert(_pdbStream != null); Debug.Assert(_symWriter != null); try { // SymWriter flushes data to the native stream on close: _symWriter.Close(); _symWriter = null; _pdbStream.CopyTo(stream); } catch (Exception ex) { throw new PdbWritingException(ex); } }
public void CloseTokenSourceLocationsScope() { if (this.symWriter5 != null) this.symWriter5.CloseMapTokensToSourceSpans(); this.symWriter5 = null; }
public void SetMetadataEmitter(object metadataEmitter) { Type t = Type.GetTypeFromProgID("CorSymWriter_SxS", false); if (t != null) { this.symWriter = (ISymUnmanagedWriter2)Activator.CreateInstance(t); this.symWriter.Initialize(metadataEmitter, this.fileName, null, true); if (this.emitTokenSourceInfo) this.symWriter5 = this.symWriter as ISymUnmanagedWriter5; } }
public void SetMetadataEmitter(object metadataEmitter) { object symWriterObject = CoCreateInstance( ref CLSID_CorSymWriter_SxS, IntPtr.Zero, CLSCTX_INPROC_SERVER, ref IID_ISymUnmanagedWriter2); if (symWriterObject != null) { this.symWriter = (ISymUnmanagedWriter2)symWriterObject; this.symWriter.Initialize(metadataEmitter, this.fileName, null, true); if (this.emitTokenSourceInfo) this.symWriter5 = this.symWriter as ISymUnmanagedWriter5; } }