Пример #1
0
 private void Close()
 {
     try
     {
         _symWriter?.Close();
         _symWriter = null;
         _pdbStream = null;
     }
     catch (Exception ex)
     {
         throw new PdbWritingException(ex);
     }
 }
Пример #2
0
        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);
            }
        }
 public UnsafeComStreamWrapper(ComMemoryStream stream)
 {
     _stream = stream;
 }