< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 72
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
GetSequencePoints()100%110%
GetStateMachineKickoffMethod()100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/MethodDebugInformation.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Reflection.Metadata
 5{
 6    /// <summary>
 7    /// Debug information associated with a method definition. Stored in debug metadata.
 8    /// </summary>
 9    /// <remarks>
 10    /// See https://github.com/dotnet/runtime/blob/main/src/libraries/System.Reflection.Metadata/specs/PortablePdb-Metad
 11    /// </remarks>
 12    public readonly struct MethodDebugInformation
 13    {
 14        private readonly MetadataReader _reader;
 15
 16        // Workaround: JIT doesn't generate good code for nested structures, so use RowId.
 17        private readonly int _rowId;
 18
 19        internal MethodDebugInformation(MetadataReader reader, MethodDebugInformationHandle handle)
 020        {
 021            _reader = reader;
 022            _rowId = handle.RowId;
 023        }
 24
 025        private MethodDebugInformationHandle Handle => MethodDebugInformationHandle.FromRowId(_rowId);
 26
 27        /// <summary>
 28        /// Returns a blob encoding sequence points, or nil if the method doesn't have sequence points.
 29        /// Use <see cref="GetSequencePoints()"/> to decode the blob.
 30        /// </summary>
 031        public BlobHandle SequencePointsBlob => _reader.MethodDebugInformationTable.GetSequencePoints(Handle);
 32
 33        /// <summary>
 34        /// Handle of the single document containing all sequence points of the method,
 35        /// or nil if the method doesn't have sequence points or spans multiple documents.
 36        /// </summary>
 037        public DocumentHandle Document => _reader.MethodDebugInformationTable.GetDocument(Handle);
 38
 39        /// <summary>
 40        /// Returns local signature handle, or nil if the method doesn't define any local variables.
 41        /// </summary>
 42        public StandaloneSignatureHandle LocalSignature
 43        {
 44            get
 045            {
 046                if (SequencePointsBlob.IsNil)
 047                {
 048                    return default(StandaloneSignatureHandle);
 49                }
 50
 051                return StandaloneSignatureHandle.FromRowId(_reader.GetBlobReader(SequencePointsBlob).ReadCompressedInteg
 052            }
 53        }
 54
 55        /// <summary>
 56        /// Returns a collection of sequence points decoded from <see cref="SequencePointsBlob"/>.
 57        /// </summary>
 58        public SequencePointCollection GetSequencePoints()
 059        {
 060            return new SequencePointCollection(_reader.BlobHeap.GetMemoryBlock(SequencePointsBlob), Document);
 061        }
 62
 63        /// <summary>
 64        /// If the method is a MoveNext method of a state machine returns the kickoff method of the state machine, other
 65        /// </summary>
 66        public MethodDefinitionHandle GetStateMachineKickoffMethod()
 067        {
 068            return _reader.StateMachineMethodTable.FindKickoffMethod(_rowId);
 069        }
 70    }
 71}
 72