diff --git a/src/coreclr/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs b/src/coreclr/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs index 9ade6db3557e56..1d026f03b3aa32 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs @@ -68,12 +68,6 @@ public object? this[object key] { ArgumentNullException.ThrowIfNull(key); - if (!key.GetType().IsSerializable) - throw new ArgumentException(SR.Argument_NotSerializable, nameof(key)); - - if ((value != null) && (!value.GetType().IsSerializable)) - throw new ArgumentException(SR.Argument_NotSerializable, nameof(value)); - throw new InvalidOperationException(SR.InvalidOperation_ReadOnly); } } @@ -91,12 +85,6 @@ public void Add(object key, object? value) { ArgumentNullException.ThrowIfNull(key); - if (!key.GetType().IsSerializable) - throw new ArgumentException(SR.Argument_NotSerializable, nameof(key)); - - if ((value != null) && (!value.GetType().IsSerializable)) - throw new ArgumentException(SR.Argument_NotSerializable, nameof(value)); - throw new InvalidOperationException(SR.InvalidOperation_ReadOnly); }