Esempio n. 1
0
 public StandaloneDebugMetadataSerializer(
     MetadataBuilder builder,
     ImmutableArray <int> typeSystemRowCounts,
     MethodDefinitionHandle entryPoint,
     bool isMinimalDelta,
     Func <IEnumerable <Blob>, BlobContentId> deterministicIdProvider = null)
     : base(builder, CreateSizes(builder, typeSystemRowCounts, isMinimalDelta, isStandaloneDebugMetadata: true), DebugMetadataVersionString)
 {
     _entryPoint = entryPoint;
     IdProvider  = deterministicIdProvider ?? BlobContentId.GetTimeBasedProvider();
 }
Esempio n. 2
0
        protected PEBuilder(PEHeaderBuilder header, Func <IEnumerable <Blob>, BlobContentId>?deterministicIdProvider)
        {
            if (header is null)
            {
                Throw.ArgumentNull(nameof(header));
            }

            IdProvider      = deterministicIdProvider ?? BlobContentId.GetTimeBasedProvider();
            IsDeterministic = deterministicIdProvider != null;
            Header          = header;
            _lazySections   = new Lazy <ImmutableArray <Section> >(CreateSections);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a builder of a Portable PDB image.
        /// </summary>
        /// <param name="tablesAndHeaps">
        /// Builder populated with debug metadata entities stored in tables and values stored in heaps.
        /// The entities and values will be enumerated when serializing the Portable PDB image.
        /// </param>
        /// <param name="typeSystemRowCounts">
        /// Row counts of all tables that the associated type-system metadata contain.
        /// Each slot in the array corresponds to a table (<see cref="TableIndex"/>).
        /// The length of the array must be equal to <see cref="MetadataTokens.TableCount"/>.
        /// </param>
        /// <param name="entryPoint">
        /// Entry point method definition handle.
        /// </param>
        /// <param name="idProvider">
        /// Function calculating id of content represented as a sequence of blobs.
        /// If not specified a default function that ignores the content and returns current time-based content id is used
        /// (<see cref="BlobContentId.GetTimeBasedProvider()"/>).
        /// You must specify a deterministic function to produce a deterministic Portable PDB image.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="tablesAndHeaps"/> or <paramref name="typeSystemRowCounts"/> is null.</exception>
        public PortablePdbBuilder(
            MetadataBuilder tablesAndHeaps,
            ImmutableArray <int> typeSystemRowCounts,
            MethodDefinitionHandle entryPoint,
            Func <IEnumerable <Blob>, BlobContentId>?idProvider = null)
        {
            if (tablesAndHeaps == null)
            {
                Throw.ArgumentNull(nameof(tablesAndHeaps));
            }

            ValidateTypeSystemRowCounts(typeSystemRowCounts);

            _builder    = tablesAndHeaps;
            _entryPoint = entryPoint;

            Debug.Assert(BlobUtilities.GetUTF8ByteCount(MetadataVersion) == MetadataVersion.Length);
            _serializedMetadata = tablesAndHeaps.GetSerializedMetadata(typeSystemRowCounts, MetadataVersion.Length, isStandaloneDebugMetadata: true);

            IdProvider = idProvider ?? BlobContentId.GetTimeBasedProvider();
        }