< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 80
Coverable lines: 80
Total lines: 255
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

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Throw.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
 4using System.Diagnostics.CodeAnalysis;
 5using System.Reflection.Metadata;
 6using System.Reflection.Metadata.Ecma335;
 7
 8namespace System.Reflection
 9{
 10    // This file defines an internal class used to throw exceptions. The main purpose is to reduce code size.
 11    // Also it improves the likelihood that callers will be inlined.
 12    internal static class Throw
 13    {
 14        [DoesNotReturn]
 15        internal static void InvalidCast()
 016        {
 017            throw new InvalidCastException();
 18        }
 19
 20        [DoesNotReturn]
 21        internal static void InvalidArgument(string message, string parameterName)
 022        {
 023            throw new ArgumentException(message, parameterName);
 24        }
 25
 26        [DoesNotReturn]
 27        internal static void InvalidArgument_OffsetForVirtualHeapHandle()
 028        {
 029            throw new ArgumentException(SR.CantGetOffsetForVirtualHeapHandle, "handle");
 30        }
 31
 32        [DoesNotReturn]
 33        internal static Exception InvalidArgument_UnexpectedHandleKind(HandleKind kind)
 034        {
 035            throw new ArgumentException(SR.Format(SR.UnexpectedHandleKind, kind));
 36        }
 37
 38        [DoesNotReturn]
 39        internal static Exception InvalidArgument_Handle(string parameterName)
 040        {
 041            throw new ArgumentException(SR.InvalidHandle, parameterName);
 42        }
 43
 44        [DoesNotReturn]
 45        internal static void SignatureNotVarArg()
 046        {
 047            throw new InvalidOperationException(SR.SignatureNotVarArg);
 48        }
 49
 50        [DoesNotReturn]
 51        internal static void ControlFlowBuilderNotAvailable()
 052        {
 053            throw new InvalidOperationException(SR.ControlFlowBuilderNotAvailable);
 54        }
 55
 56        [DoesNotReturn]
 57        internal static void InvalidOperationBuilderAlreadyLinked()
 058        {
 059            throw new InvalidOperationException(SR.BuilderAlreadyLinked);
 60        }
 61
 62        [DoesNotReturn]
 63        internal static void InvalidOperation(string message)
 064        {
 065            throw new InvalidOperationException(message);
 66        }
 67
 68        [DoesNotReturn]
 69        internal static void InvalidOperation_LabelNotMarked(int id)
 070        {
 071            throw new InvalidOperationException(SR.Format(SR.LabelNotMarked, id));
 72        }
 73
 74        [DoesNotReturn]
 75        internal static void LabelDoesntBelongToBuilder(string parameterName)
 076        {
 077            throw new ArgumentException(SR.LabelDoesntBelongToBuilder, parameterName);
 78        }
 79
 80        [DoesNotReturn]
 81        internal static void HeapHandleRequired()
 082        {
 083            throw new ArgumentException(SR.NotMetadataHeapHandle, "handle");
 84        }
 85
 86        [DoesNotReturn]
 87        internal static void EntityOrUserStringHandleRequired()
 088        {
 089            throw new ArgumentException(SR.NotMetadataTableOrUserStringHandle, "handle");
 90        }
 91
 92        [DoesNotReturn]
 93        internal static void InvalidToken()
 094        {
 095            throw new ArgumentException(SR.InvalidToken, "token");
 96        }
 97
 98        [DoesNotReturn]
 99        internal static void ArgumentNull(string parameterName)
 0100        {
 0101            throw new ArgumentNullException(parameterName);
 102        }
 103
 104        [DoesNotReturn]
 105        internal static void ArgumentEmptyString(string parameterName)
 0106        {
 0107            throw new ArgumentException(SR.ExpectedNonEmptyString, parameterName);
 108        }
 109
 110        [DoesNotReturn]
 111        internal static void ArgumentEmptyArray(string parameterName)
 0112        {
 0113            throw new ArgumentException(SR.ExpectedNonEmptyArray, parameterName);
 114        }
 115
 116        [DoesNotReturn]
 117        internal static void ArgumentOutOfRange(string parameterName)
 0118        {
 0119            throw new ArgumentOutOfRangeException(parameterName);
 120        }
 121
 122        [DoesNotReturn]
 123        internal static void ArgumentOutOfRange(string parameterName, string message)
 0124        {
 0125            throw new ArgumentOutOfRangeException(parameterName, message);
 126        }
 127
 128        [DoesNotReturn]
 129        internal static void BlobTooLarge(string parameterName)
 0130        {
 0131            throw new ArgumentOutOfRangeException(parameterName, SR.BlobTooLarge);
 132        }
 133
 134        [DoesNotReturn]
 135        internal static void IndexOutOfRange()
 0136        {
 0137            throw new ArgumentOutOfRangeException("index");
 138        }
 139
 140        [DoesNotReturn]
 141        internal static void TableIndexOutOfRange()
 0142        {
 0143            throw new ArgumentOutOfRangeException("tableIndex");
 144        }
 145
 146        [DoesNotReturn]
 147        internal static void ValueArgumentOutOfRange()
 0148        {
 0149            throw new ArgumentOutOfRangeException("value");
 150        }
 151
 152        [DoesNotReturn]
 153        internal static void OutOfBounds()
 0154        {
 0155            throw new BadImageFormatException(SR.OutOfBoundsRead);
 156        }
 157
 158        [DoesNotReturn]
 159        internal static void WriteOutOfBounds()
 0160        {
 0161            throw new InvalidOperationException(SR.OutOfBoundsWrite);
 162        }
 163
 164        [DoesNotReturn]
 165        internal static void InvalidCodedIndex()
 0166        {
 0167            throw new BadImageFormatException(SR.InvalidCodedIndex);
 168        }
 169
 170        [DoesNotReturn]
 171        internal static void InvalidHandle()
 0172        {
 0173            throw new BadImageFormatException(SR.InvalidHandle);
 174        }
 175
 176        [DoesNotReturn]
 177        internal static void InvalidCompressedInteger()
 0178        {
 0179            throw new BadImageFormatException(SR.InvalidCompressedInteger);
 180        }
 181
 182        [DoesNotReturn]
 183        internal static void InvalidSerializedString()
 0184        {
 0185            throw new BadImageFormatException(SR.InvalidSerializedString);
 186        }
 187
 188        [DoesNotReturn]
 189        internal static void ImageTooSmall()
 0190        {
 0191            throw new BadImageFormatException(SR.ImageTooSmall);
 192        }
 193
 194        [DoesNotReturn]
 195        internal static void ImageTooSmallOrContainsInvalidOffsetOrCount()
 0196        {
 0197            throw new BadImageFormatException(SR.ImageTooSmallOrContainsInvalidOffsetOrCount);
 198        }
 199
 200        [DoesNotReturn]
 201        internal static void ReferenceOverflow()
 0202        {
 0203            throw new BadImageFormatException(SR.RowIdOrHeapOffsetTooLarge);
 204        }
 205
 206        [DoesNotReturn]
 207        internal static void TableNotSorted(TableIndex tableIndex)
 0208        {
 0209            throw new BadImageFormatException(SR.Format(SR.MetadataTableNotSorted, tableIndex));
 210        }
 211
 212        [DoesNotReturn]
 213        internal static void InvalidOperation_TableNotSorted(TableIndex tableIndex)
 0214        {
 0215            throw new InvalidOperationException(SR.Format(SR.MetadataTableNotSorted, tableIndex));
 216        }
 217
 218        [DoesNotReturn]
 219        internal static void InvalidOperation_PEImageNotAvailable()
 0220        {
 0221            throw new InvalidOperationException(SR.PEImageNotAvailable);
 222        }
 223
 224        [DoesNotReturn]
 225        internal static void TooManySubnamespaces()
 0226        {
 0227            throw new BadImageFormatException(SR.TooManySubnamespaces);
 228        }
 229
 230        [DoesNotReturn]
 231        internal static void ValueOverflow()
 0232        {
 0233            throw new BadImageFormatException(SR.ValueTooLarge);
 234        }
 235
 236        [DoesNotReturn]
 237        internal static void SequencePointValueOutOfRange()
 0238        {
 0239            throw new BadImageFormatException(SR.SequencePointValueOutOfRange);
 240        }
 241
 242        [DoesNotReturn]
 243        internal static void HeapSizeLimitExceeded(HeapIndex heap)
 0244        {
 0245            throw new ImageFormatLimitationException(SR.Format(SR.HeapSizeLimitExceeded, heap));
 246        }
 247
 248        [DoesNotReturn]
 249        internal static void PEReaderDisposed()
 0250        {
 0251            throw new ObjectDisposedException(nameof(PortableExecutable.PEReader));
 252        }
 253    }
 254}
 255