diff options
author | Andrew Hoefling <andrew@hoeflingsoftware.com> | 2019-03-06 12:57:09 -0500 |
---|---|---|
committer | Santiago Fernandez Madero <safern@microsoft.com> | 2019-03-08 11:20:58 -0800 |
commit | 44e05888b328699d3a0ca4b76544d7c357b49b47 (patch) | |
tree | 25025d149c9a2d9d73bdcc8eff3b2c4627cfddc4 /src | |
parent | 39be7e55798e4f81c531661b0df798e91c7d5936 (diff) | |
download | coreclr-44e05888b328699d3a0ca4b76544d7c357b49b47.tar.gz coreclr-44e05888b328699d3a0ca4b76544d7c357b49b47.tar.bz2 coreclr-44e05888b328699d3a0ca4b76544d7c357b49b47.zip |
InsertItemsRange API now checks if the underlying items.IsReadOnly first then collection == null
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs b/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs index 8aa387b0cd..f6d7f9878b 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/ObjectModel/Collection.cs @@ -172,14 +172,14 @@ namespace System.Collections.ObjectModel protected virtual void InsertItemsRange(int index, IEnumerable<T> collection) { - if (collection == null) + if (items.IsReadOnly) { - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.list); + ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection); } - if (items.IsReadOnly) + if (collection == null) { - ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection); + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.list); } if ((uint)index > (uint)items.Count) |