< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 34
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%
Dispose()100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/ExternalMemoryBlock.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.Internal
 5{
 6    /// <summary>
 7    /// Class representing raw memory but not owning the memory.
 8    /// </summary>
 9    internal sealed unsafe class ExternalMemoryBlock : AbstractMemoryBlock
 10    {
 11        // keeps the owner of the memory alive as long as the block is alive:
 12        private readonly object _memoryOwner;
 13
 14        private byte* _buffer;
 15        private int _size;
 16
 017        public ExternalMemoryBlock(object memoryOwner, byte* buffer, int size)
 018        {
 019            _memoryOwner = memoryOwner;
 020            _buffer = buffer;
 021            _size = size;
 022        }
 23
 24        public override void Dispose()
 025        {
 026            _buffer = null;
 027            _size = 0;
 028        }
 29
 030        public override byte* Pointer => _buffer;
 031        public override int Size => _size;
 32    }
 33}
 34