summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/ThrowHelper.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-02-10 11:35:12 (GMT)
committerJiyoung Yun <jy910.yun@samsung.com>2017-02-10 11:35:12 (GMT)
commit4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch)
treeb48831a898906734f8884d08b6e18f1144ee2b82 /src/mscorlib/src/System/ThrowHelper.cs
parentdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff)
downloadcoreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.zip
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.gz
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.bz2
Imported Upstream version 1.0.0.9910upstream/1.0.0.9910
Diffstat (limited to 'src/mscorlib/src/System/ThrowHelper.cs')
-rw-r--r--src/mscorlib/src/System/ThrowHelper.cs36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/mscorlib/src/System/ThrowHelper.cs b/src/mscorlib/src/System/ThrowHelper.cs
index a534dec..1ed8317 100644
--- a/src/mscorlib/src/System/ThrowHelper.cs
+++ b/src/mscorlib/src/System/ThrowHelper.cs
@@ -39,12 +39,10 @@ namespace System {
using Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
- using System.Diagnostics;
using System.Diagnostics.Contracts;
[Pure]
internal static class ThrowHelper {
-#if FEATURE_SPAN_OF_T
internal static void ThrowArrayTypeMismatchException() {
throw new ArrayTypeMismatchException();
}
@@ -72,7 +70,6 @@ namespace System {
internal static void ThrowNotSupportedException_CannotCallGetHashCodeOnSpan() {
throw new NotSupportedException(Environment.GetResourceString("NotSupported_CannotCallGetHashCodeOnSpan"));
}
-#endif
internal static void ThrowArgumentOutOfRange_IndexException() {
throw GetArgumentOutOfRangeException(ExceptionArgument.index,
@@ -127,8 +124,12 @@ namespace System {
throw GetArgumentException(resource, argument);
}
+ private static ArgumentNullException GetArgumentNullException(ExceptionArgument argument) {
+ return new ArgumentNullException(GetArgumentName(argument));
+ }
+
internal static void ThrowArgumentNullException(ExceptionArgument argument) {
- throw new ArgumentNullException(GetArgumentName(argument));
+ throw GetArgumentNullException(argument);
}
internal static void ThrowArgumentNullException(ExceptionResource resource) {
@@ -211,11 +212,27 @@ namespace System {
throw GetInvalidOperationException(ExceptionResource.InvalidOperation_EnumOpCantHappen);
}
+ internal static void ThrowArraySegmentCtorValidationFailedExceptions(Array array, int offset, int count) {
+ throw GetArraySegmentCtorValidationFailedException(array, offset, count);
+ }
+
+ private static Exception GetArraySegmentCtorValidationFailedException(Array array, int offset, int count) {
+ if (array == null)
+ return GetArgumentNullException(ExceptionArgument.array);
+ if (offset < 0)
+ return GetArgumentOutOfRangeException(ExceptionArgument.offset, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ if (count < 0)
+ return GetArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+
+ Debug.Assert(array.Length - offset < count);
+ return GetArgumentException(ExceptionResource.Argument_InvalidOffLen);
+ }
+
private static ArgumentException GetArgumentException(ExceptionResource resource) {
return new ArgumentException(GetResourceString(resource));
}
- private static InvalidOperationException GetInvalidOperationException(ExceptionResource resource) {
+ internal static InvalidOperationException GetInvalidOperationException(ExceptionResource resource) {
return new InvalidOperationException(GetResourceString(resource));
}
@@ -227,7 +244,7 @@ namespace System {
return new ArgumentException(Environment.GetResourceString("Arg_WrongType", value, targetType), nameof(value));
}
- private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) {
+ internal static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) {
return new ArgumentOutOfRangeException(GetArgumentName(argument), GetResourceString(resource));
}
@@ -363,7 +380,8 @@ namespace System {
updateValueFactory,
concurrencyLevel,
text,
-
+ callBack,
+ type,
}
//
@@ -453,7 +471,6 @@ namespace System {
Task_ContinueWith_NotOnAnything,
Task_ContinueWith_ESandLR,
TaskT_TransitionToFinal_AlreadyCompleted,
- TaskT_ctor_SelfReplicating,
TaskCompletionSourceT_TrySetException_NullException,
TaskCompletionSourceT_TrySetException_NoExceptions,
InvalidOperation_WrongAsyncResultOrEndCalledMultiple,
@@ -468,7 +485,8 @@ namespace System {
ConcurrentDictionary_ArrayNotLargeEnough,
ConcurrentDictionary_ArrayIncorrectType,
ConcurrentCollection_SyncRoot_NotSupported,
-
+ ArgumentOutOfRange_Enum,
+ InvalidOperation_HandleIsNotInitialized,
}
}