diff options
author | Marek Safar <marek.safar@gmail.com> | 2018-01-09 19:45:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-09 19:45:26 +0300 |
commit | 25bff86cee04cc852ae453702e1ae83b8fe7c3b9 (patch) | |
tree | 73fed62dd03f1d660bb2498e93275e765fb881ad /mcs/class/referencesource | |
parent | ad5703adfd84c309292d4c33a2fcaa5e60de9100 (diff) |
Bump corert (#6420)
* Bump corert
* Bump API snapshot submodule
Diffstat (limited to 'mcs/class/referencesource')
-rw-r--r-- | mcs/class/referencesource/mscorlib/system/throwhelper.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/mcs/class/referencesource/mscorlib/system/throwhelper.cs b/mcs/class/referencesource/mscorlib/system/throwhelper.cs index 95a5bb12487..523f467e8ff 100644 --- a/mcs/class/referencesource/mscorlib/system/throwhelper.cs +++ b/mcs/class/referencesource/mscorlib/system/throwhelper.cs @@ -49,6 +49,7 @@ namespace System { using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Diagnostics.Contracts; + using System.Collections.Generic; [Pure] internal static partial class ThrowHelper { @@ -121,6 +122,61 @@ namespace System { throw new ObjectDisposedException(objectName, Environment.GetResourceString(GetResourceName(resource))); } +#if MONO + internal static void ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion() + { + throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion); + } + + internal static void ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen() + { + throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen); + } + + internal static void ThrowInvalidOperationException_InvalidOperation_EnumNotStarted() + { + throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); + } + + internal static void ThrowInvalidOperationException_InvalidOperation_EnumEnded() + { + throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); + } + + private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, string resource) + { + return new ArgumentOutOfRangeException(GetArgumentName(argument), resource); + } + internal static void ThrowIndexArgumentOutOfRange_NeedNonNegNumException() + { + throw GetArgumentOutOfRangeException(ExceptionArgument.index, + SR.ArgumentOutOfRange_NeedNonNegNum); + } + + internal static void ThrowArgumentException_Argument_InvalidArrayType() + { + throw new ArgumentException(SR.Argument_InvalidArrayType); + } + + private static ArgumentException GetAddingDuplicateWithKeyArgumentException(object key) + { + return new ArgumentException(SR.Format(SR.Argument_AddingDuplicate, key)); + } + internal static void ThrowAddingDuplicateWithKeyArgumentException(object key) + { + throw GetAddingDuplicateWithKeyArgumentException(key); + } + + private static KeyNotFoundException GetKeyNotFoundException(object key) + { + throw new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, key.ToString())); + } + internal static void ThrowKeyNotFoundException(object key) + { + throw GetKeyNotFoundException(key); + } +#endif + // Allow nulls for reference types and Nullable<U>, but not for value types. internal static void IfNullAndNullsAreIllegalThenThrow<T>(object value, ExceptionArgument argName) { // Note that default(T) is not equal to null for value types except when T is Nullable<U>. |