WindowsPdbWriter(PdbState pdbState, Metadata metadata)
 {
     this.pdbState = pdbState;
     this.metadata = metadata;
     module        = metadata.Module;
     instrToOffset = new Dictionary <Instruction, uint>();
     customDebugInfoWriterContext = new PdbCustomDebugInfoWriterContext();
     localsEndScopeIncValue       = PdbUtils.IsEndInclusive(PdbFileKind.WindowsPDB, pdbState.Compiler) ? 1 : 0;
 }
 PdbCustomDebugInfoWriter(Metadata metadata, MethodDef method, PdbCustomDebugInfoWriterContext context)
 {
     this.metadata                = metadata;
     this.method                  = method;
     logger                       = context.Logger;
     memoryStream                 = context.MemoryStream;
     writer                       = context.Writer;
     instructionToOffsetDict      = context.InstructionToOffsetDict;
     bodySize                     = 0;
     instructionToOffsetDictInitd = false;
     memoryStream.SetLength(0);
     memoryStream.Position = 0;
 }
        /// <summary>
        /// Returns the raw custom debug info or null if there was an error
        /// </summary>
        /// <param name="metadata">Metadata</param>
        /// <param name="context">Writer context</param>
        /// <param name="method">Method</param>
        /// <param name="customDebugInfos">Custom debug infos to write</param>
        /// <returns></returns>
        public static byte[] Write(Metadata metadata, MethodDef method, PdbCustomDebugInfoWriterContext context, IList <PdbCustomDebugInfo> customDebugInfos)
        {
            var writer = new PdbCustomDebugInfoWriter(metadata, method, context);

            return(writer.Write(customDebugInfos));
        }