< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 63
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyFile.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    public readonly struct AssemblyFile
 7    {
 8        private readonly MetadataReader _reader;
 9
 10        // Workaround: JIT doesn't generate good code for nested structures, so use RowId.
 11        private readonly int _rowId;
 12
 13        internal AssemblyFile(MetadataReader reader, AssemblyFileHandle handle)
 014        {
 015            _reader = reader;
 016            _rowId = handle.RowId;
 017        }
 18
 19        private AssemblyFileHandle Handle
 20        {
 021            get { return AssemblyFileHandle.FromRowId(_rowId); }
 22        }
 23
 24        /// <summary>
 25        /// True if the file contains metadata.
 26        /// </summary>
 27        /// <remarks>
 28        /// Corresponds to Flags field of File table in ECMA-335 Standard.
 29        /// </remarks>
 30        public bool ContainsMetadata
 31        {
 032            get { return _reader.FileTable.GetFlags(Handle) == 0; }
 33        }
 34
 35        /// <summary>
 36        /// File name with extension.
 37        /// </summary>
 38        /// <remarks>
 39        /// Corresponds to Name field of File table in ECMA-335 Standard.
 40        /// </remarks>
 41        public StringHandle Name
 42        {
 043            get { return _reader.FileTable.GetName(Handle); }
 44        }
 45
 46        /// <summary>
 47        /// Hash value of the file content calculated using <see cref="AssemblyDefinition.HashAlgorithm"/>.
 48        /// </summary>
 49        /// <remarks>
 50        /// Corresponds to HashValue field of File table in ECMA-335 Standard.
 51        /// </remarks>
 52        public BlobHandle HashValue
 53        {
 054            get { return _reader.FileTable.GetHashValue(Handle); }
 55        }
 56
 57        public CustomAttributeHandleCollection GetCustomAttributes()
 058        {
 059            return new CustomAttributeHandleCollection(_reader, Handle);
 060        }
 61    }
 62}
 63