diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs index 90ee64b8e0be0c..514736b2778ea7 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -799,7 +799,7 @@ public MethodBuilder DefinePInvokeMethod(string name, string dllName, string ent // Global methods must be static. if ((attributes & MethodAttributes.Static) == 0) { - throw new ArgumentException(SR.Argument_GlobalFunctionHasToBeStatic); + throw new ArgumentException(SR.Argument_GlobalMembersMustBeStatic); } return _globalTypeBuilder.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet); @@ -829,7 +829,7 @@ private MethodBuilder DefineGlobalMethodNoLock(string name, MethodAttributes att ArgumentException.ThrowIfNullOrEmpty(name); if ((attributes & MethodAttributes.Static) == 0) { - throw new ArgumentException(SR.Argument_GlobalFunctionHasToBeStatic); + throw new ArgumentException(SR.Argument_GlobalMembersMustBeStatic); } return _globalTypeBuilder.DefineMethod(name, attributes, callingConvention, diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs index bb1414d6a36499..e2babde84e7c15 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @@ -2737,33 +2737,33 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) return members; } - public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type ifaceType) + public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) { if (IsGenericParameter) throw new InvalidOperationException(SR.Arg_GenericParameter); - ArgumentNullException.ThrowIfNull(ifaceType); + ArgumentNullException.ThrowIfNull(interfaceType); - RuntimeType? ifaceRtType = ifaceType as RuntimeType; + RuntimeType? ifaceRtType = interfaceType as RuntimeType; if (ifaceRtType == null) - throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(ifaceType)); + throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(interfaceType)); RuntimeTypeHandle ifaceRtTypeHandle = ifaceRtType.TypeHandle; TypeHandle.VerifyInterfaceIsImplemented(ifaceRtTypeHandle); - Debug.Assert(ifaceType.IsInterface); // VerifyInterfaceIsImplemented enforces this invariant + Debug.Assert(interfaceType.IsInterface); // VerifyInterfaceIsImplemented enforces this invariant Debug.Assert(!IsInterface); // VerifyInterfaceIsImplemented enforces this invariant // SZArrays implement the methods on IList`1, IEnumerable`1, and ICollection`1 with // SZArrayHelper and some runtime magic. We don't have accurate interface maps for them. - if (IsSZArray && ifaceType.IsGenericType) + if (IsSZArray && interfaceType.IsGenericType) throw new ArgumentException(SR.Argument_ArrayGetInterfaceMap); int ifaceVirtualMethodCount = RuntimeTypeHandle.GetNumVirtualsAndStaticVirtuals(ifaceRtType); InterfaceMapping im; - im.InterfaceType = ifaceType; + im.InterfaceType = interfaceType; im.TargetType = this; im.InterfaceMethods = new MethodInfo[ifaceVirtualMethodCount]; im.TargetMethods = new MethodInfo[ifaceVirtualMethodCount]; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs index 909d0798c9dae0..3157fdfd01386b 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs @@ -188,7 +188,7 @@ public sealed override MemberInfo[] GetDefaultMembers() return defaultMemberName != null ? GetMember(defaultMemberName) : Array.Empty(); } - public sealed override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type ifaceType) + public sealed override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) { // restrictions and known limitations compared to CoreCLR: // - only interface.GetMethods() reflection visible interface methods are returned @@ -199,27 +199,27 @@ public sealed override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMemb if (IsGenericParameter) throw new InvalidOperationException(SR.Arg_GenericParameter); - if (ifaceType is null) - throw new ArgumentNullException(nameof(ifaceType)); + if (interfaceType is null) + throw new ArgumentNullException(nameof(interfaceType)); - if (!(ifaceType is RuntimeTypeInfo)) - throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(ifaceType)); + if (!(interfaceType is RuntimeTypeInfo)) + throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(interfaceType)); - RuntimeTypeHandle interfaceTypeHandle = ifaceType.TypeHandle; + RuntimeTypeHandle interfaceTypeHandle = interfaceType.TypeHandle; ReflectionCoreExecution.ExecutionEnvironment.VerifyInterfaceIsImplemented(TypeHandle, interfaceTypeHandle); - Debug.Assert(ifaceType.IsInterface); + Debug.Assert(interfaceType.IsInterface); Debug.Assert(!IsInterface); // SZArrays implement the methods on IList`1, IEnumerable`1, and ICollection`1 with // runtime magic. We don't have accurate interface maps for them. - if (IsSZArray && ifaceType.IsGenericType) + if (IsSZArray && interfaceType.IsGenericType) throw new ArgumentException(SR.Argument_ArrayGetInterfaceMap); - ReflectionCoreExecution.ExecutionEnvironment.GetInterfaceMap(this, ifaceType, out MethodInfo[] interfaceMethods, out MethodInfo[] targetMethods); + ReflectionCoreExecution.ExecutionEnvironment.GetInterfaceMap(this, interfaceType, out MethodInfo[] interfaceMethods, out MethodInfo[] targetMethods); InterfaceMapping im; - im.InterfaceType = ifaceType; + im.InterfaceType = interfaceType; im.TargetType = this; im.InterfaceMethods = interfaceMethods; im.TargetMethods = targetMethods; diff --git a/src/libraries/System.Collections.Immutable/src/Resources/Strings.resx b/src/libraries/System.Collections.Immutable/src/Resources/Strings.resx index 8f13478c75da20..5abd00a70bd3b4 100644 --- a/src/libraries/System.Collections.Immutable/src/Resources/Strings.resx +++ b/src/libraries/System.Collections.Immutable/src/Resources/Strings.resx @@ -99,7 +99,7 @@ Destination array is not long enough to copy all the items in the collection. Check array index and length. - + Target array type is not compatible with the type of items in the collection. diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenDictionary.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenDictionary.cs index aeb329511df18f..837650027bb9c5 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenDictionary.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenDictionary.cs @@ -283,7 +283,7 @@ void ICollection.CopyTo(Array array, int index) { if (array is not object[] objects) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } try @@ -295,7 +295,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } diff --git a/src/libraries/System.Collections/src/Resources/Strings.resx b/src/libraries/System.Collections/src/Resources/Strings.resx index 38e3d082d1a66e..37569a0b07de5c 100644 --- a/src/libraries/System.Collections/src/Resources/Strings.resx +++ b/src/libraries/System.Collections/src/Resources/Strings.resx @@ -123,7 +123,7 @@ The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue. - + Target array type is not compatible with the type of items in the collection. diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/LinkedList.cs b/src/libraries/System.Collections/src/System/Collections/Generic/LinkedList.cs index 1c34a60d633c28..7c41bb8875ef09 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/LinkedList.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/LinkedList.cs @@ -482,7 +482,7 @@ void ICollection.CopyTo(Array array, int index) object?[]? objects = array as object[]; if (objects == null) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } LinkedListNode? node = head; try @@ -498,7 +498,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs b/src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs index c1ee53a83e1e77..6792c4922a4491 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs @@ -886,7 +886,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs b/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs index ab700e3a88e8a3..3c23ba2d07ec08 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs @@ -612,7 +612,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } @@ -786,7 +786,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/SortedList.cs b/src/libraries/System.Collections/src/System/Collections/Generic/SortedList.cs index 3560806d4e4153..4588556af29328 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/SortedList.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/SortedList.cs @@ -486,7 +486,7 @@ void ICollection.CopyTo(Array array, int index) object[]? objects = array as object[]; if (objects == null) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } try @@ -498,7 +498,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } @@ -1071,7 +1071,7 @@ void ICollection.CopyTo(Array array, int arrayIndex) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } @@ -1189,7 +1189,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs b/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs index 2c3e54002e6216..a298779f293ff3 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs @@ -574,7 +574,7 @@ void ICollection.CopyTo(Array array, int index) object?[]? objects = array as object[]; if (objects == null) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } try @@ -587,7 +587,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/Stack.cs b/src/libraries/System.Collections/src/System/Collections/Generic/Stack.cs index aa7a92b38f0e1a..3c3938c60d88b9 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/Stack.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/Stack.cs @@ -148,7 +148,7 @@ void ICollection.CopyTo(Array array, int arrayIndex) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } diff --git a/src/libraries/System.ObjectModel/src/Resources/Strings.resx b/src/libraries/System.ObjectModel/src/Resources/Strings.resx index 19a24c76d32f7c..f2a98df105a1e4 100644 --- a/src/libraries/System.ObjectModel/src/Resources/Strings.resx +++ b/src/libraries/System.ObjectModel/src/Resources/Strings.resx @@ -99,7 +99,7 @@ Only single dimensional arrays are supported for the requested action. - + Target array type is not compatible with the type of items in the collection. diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index f7f062fadc20d5..2b8bf16f6e4333 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -1053,7 +1053,7 @@ Generic types are not valid. - + Global members must be static. @@ -1110,7 +1110,7 @@ Length of the array must be {0}. - + Target array type is not compatible with the type of items in the collection. diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs index fbf118d5d33f62..3b840d04efafd7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs @@ -1078,7 +1078,7 @@ void ICollection.CopyTo(Array array, int index) object[]? objects = array as object[]; if (objects == null) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } try @@ -1095,7 +1095,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } } } @@ -1553,7 +1553,7 @@ void ICollection.CopyTo(Array array, int index) object[]? objects = array as object[]; if (objects == null) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } int count = _dictionary._count; @@ -1567,7 +1567,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } } } @@ -1745,7 +1745,7 @@ void ICollection.CopyTo(Array array, int index) object[]? objects = array as object[]; if (objects == null) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } int count = _dictionary._count; @@ -1759,7 +1759,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs index 81295d8c735581..5e358bce9b6e13 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs @@ -398,7 +398,7 @@ void ICollection.CopyTo(Array array, int arrayIndex) } catch (ArrayTypeMismatchException) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Queue.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Queue.cs index b850e3649a748d..327aa1c64a19d9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Queue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Queue.cs @@ -164,7 +164,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs index 6155619df496a8..80c2cc064226b3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs @@ -209,7 +209,7 @@ void ICollection.CopyTo(Array array, int index) Type sourceType = typeof(T); if (!(targetType.IsAssignableFrom(sourceType) || sourceType.IsAssignableFrom(targetType))) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } // @@ -219,7 +219,7 @@ void ICollection.CopyTo(Array array, int index) object?[]? objects = array as object[]; if (objects == null) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } int count = items.Count; @@ -232,7 +232,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/CollectionHelpers.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/CollectionHelpers.cs index ee843c0035732f..d84958d4f0aaad 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/CollectionHelpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/CollectionHelpers.cs @@ -50,7 +50,7 @@ internal static void CopyTo(ICollection collection, Array array, int index // We can't cast array of value type to object[], so we don't support widening of primitive types here. if (array is not object?[] objects) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } try @@ -62,7 +62,7 @@ internal static void CopyTo(ICollection collection, Array array, int index } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs index 4e4bb70d1190d1..57be3812a5142c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs @@ -140,7 +140,7 @@ void ICollection.CopyTo(Array array, int index) Type sourceType = typeof(T); if (!(targetType.IsAssignableFrom(sourceType) || sourceType.IsAssignableFrom(targetType))) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } // @@ -150,7 +150,7 @@ void ICollection.CopyTo(Array array, int index) object?[]? objects = array as object[]; if (objects == null) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } int count = list.Count; @@ -163,7 +163,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType(); + ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType(); } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs index 31fd226ea0aa7e..d13a7198f07493 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs @@ -193,7 +193,7 @@ void ICollection.CopyTo(Array array, int index) object[]? objects = array as object[]; if (objects == null) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } try @@ -205,7 +205,7 @@ void ICollection.CopyTo(Array array, int index) } catch (ArrayTypeMismatchException) { - throw new ArgumentException(SR.Argument_InvalidArrayType, nameof(array)); + throw new ArgumentException(SR.Argument_IncompatibleArrayType, nameof(array)); } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs b/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs index 55dda55d8e5bf6..c9b3e589dcc3b4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs @@ -438,9 +438,9 @@ internal static void ThrowOutOfMemoryException() } [DoesNotReturn] - internal static void ThrowArgumentException_Argument_InvalidArrayType() + internal static void ThrowArgumentException_Argument_IncompatibleArrayType() { - throw new ArgumentException(SR.Argument_InvalidArrayType); + throw new ArgumentException(SR.Argument_IncompatibleArrayType); } [DoesNotReturn] diff --git a/src/libraries/System.Reflection.Extensions/tests/RuntimeReflectionExtensionTests.cs b/src/libraries/System.Reflection.Extensions/tests/RuntimeReflectionExtensionTests.cs index 5b8aa82795c00c..2d278ae88ee5d1 100644 --- a/src/libraries/System.Reflection.Extensions/tests/RuntimeReflectionExtensionTests.cs +++ b/src/libraries/System.Reflection.Extensions/tests/RuntimeReflectionExtensionTests.cs @@ -300,7 +300,7 @@ public void GetRuntimeBaseDefinition() public void GetRuntimeInterfaceMap() { AssertExtensions.Throws("typeInfo", () => default(TypeInfo).GetRuntimeInterfaceMap(typeof(ICloneable))); - AssertExtensions.Throws("ifaceType", () => typeof(TestType).GetTypeInfo().GetRuntimeInterfaceMap(null)); + AssertExtensions.Throws("interfaceType", () => typeof(TestType).GetTypeInfo().GetRuntimeInterfaceMap(null)); Assert.Throws(() => typeof(TestType).GetTypeInfo().GetRuntimeInterfaceMap(typeof(ICloneable))); Assert.Throws(() => typeof(TestType).GetTypeInfo().GetRuntimeInterfaceMap(typeof(string))); diff --git a/src/mono/System.Private.CoreLib/src/Mono/HotReload.cs b/src/mono/System.Private.CoreLib/src/Mono/HotReload.cs index afdcc34cabbc9c..bd3d1002c91033 100644 --- a/src/mono/System.Private.CoreLib/src/Mono/HotReload.cs +++ b/src/mono/System.Private.CoreLib/src/Mono/HotReload.cs @@ -100,7 +100,7 @@ private FieldStore (object? loc) [RequiresUnreferencedCode("Hot reload required untrimmed apps")] public static FieldStore Create (RuntimeTypeHandle type) { - Type t = Type.GetTypeFromHandle(type) ?? throw new ArgumentException(nameof(type), "Type handle was null"); + Type t = Type.GetTypeFromHandle(type) ?? throw new ArgumentException(SR.Arg_InvalidHandle, nameof(type)); object? loc; if (t.IsPrimitive || t.IsValueType) loc = RuntimeHelpers.GetUninitializedObject(t); diff --git a/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs b/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs index 0a8400925d7942..1209465f604ced 100644 --- a/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs +++ b/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs @@ -47,7 +47,7 @@ public void End() public override bool Equals(object? o) { - throw new NotSupportedException("ArgIterator does not support Equals."); + throw new NotSupportedException(SR.NotSupported_NYI); } public override int GetHashCode() @@ -59,7 +59,7 @@ public override int GetHashCode() public TypedReference GetNextArg() { if (num_args == next_arg) - throw new InvalidOperationException("Invalid iterator position."); + throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); TypedReference result = default; unsafe { @@ -75,7 +75,7 @@ public TypedReference GetNextArg() public TypedReference GetNextArg(RuntimeTypeHandle rth) { if (num_args == next_arg) - throw new InvalidOperationException("Invalid iterator position."); + throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); TypedReference result = default; unsafe { @@ -90,7 +90,7 @@ public TypedReference GetNextArg(RuntimeTypeHandle rth) public RuntimeTypeHandle GetNextArgType() { if (num_args == next_arg) - throw new InvalidOperationException("Invalid iterator position."); + throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); return new RuntimeTypeHandle(IntGetNextArgType()); } diff --git a/src/mono/System.Private.CoreLib/src/System/Delegate.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Delegate.Mono.cs index 68d4552e54f6e7..d40e212a672fa2 100644 --- a/src/mono/System.Private.CoreLib/src/System/Delegate.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Delegate.Mono.cs @@ -427,7 +427,7 @@ private static bool IsArgumentTypeMatchWithThis(Type delArgType, Type argType, b protected virtual object? DynamicInvokeImpl(object?[]? args) { - MethodInfo _method = Method ?? throw new NullReferenceException ("method_info is null"); + MethodInfo method = Method; object? target = _target; @@ -451,7 +451,7 @@ private static bool IsArgumentTypeMatchWithThis(Type delArgType, Type argType, b } } - if (_method.IsStatic) + if (method.IsStatic) { // // The delegate is bound to _target @@ -482,7 +482,7 @@ private static bool IsArgumentTypeMatchWithThis(Type delArgType, Type argType, b } } - return _method.Invoke(target, args); + return method.Invoke(target, args); } public override bool Equals([NotNullWhen(true)] object? obj) diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs index 00abf6c9cfddcb..db1e1205c2aec7 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs @@ -166,7 +166,7 @@ internal static object[] GetCustomAttributes(ICustomAttributeProvider obj, Type if (!inherit && res.Length == 1) { if (res[0] == null) - throw new CustomAttributeFormatException("Invalid custom attribute format"); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); if (attributeType != null && !attributeType.IsGenericTypeDefinition) { @@ -214,7 +214,7 @@ internal static object[] GetCustomAttributes(ICustomAttributeProvider obj, Type foreach (object attr in res) { if (attr == null) - throw new CustomAttributeFormatException("Invalid custom attribute format"); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); } var result = new Attribute[res.Length]; res.CopyTo(result, 0); @@ -225,7 +225,7 @@ internal static object[] GetCustomAttributes(ICustomAttributeProvider obj, Type foreach (object attr in res) { if (attr == null) - throw new CustomAttributeFormatException("Invalid custom attribute format"); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); if (AttrTypeMatches(attributeType, attr.GetType())) a.Add(attr); @@ -250,7 +250,7 @@ internal static object[] GetCustomAttributes(ICustomAttributeProvider obj, Type { AttributeUsageAttribute usage; if (attr == null) - throw new CustomAttributeFormatException("Invalid custom attribute format"); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); Type attrType = attr.GetType(); if (!AttrTypeMatches(attributeType, attr.GetType())) @@ -332,14 +332,13 @@ internal static IList GetCustomAttributesData(ICustomAttrib if (attributeType == typeof(CustomAttribute)) attributeType = null; - const string Message = "Invalid custom attribute data format"; IList r; IList res = GetCustomAttributesDataBase(obj, attributeType, false); // shortcut if (!inherit && res.Count == 1) { if (res[0] == null) - throw new CustomAttributeFormatException(Message); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); if (attributeType != null) { if (attributeType.IsAssignableFrom(res[0].AttributeType)) @@ -379,7 +378,7 @@ internal static IList GetCustomAttributesData(ICustomAttrib foreach (CustomAttributeData attrData in res) { if (attrData == null) - throw new CustomAttributeFormatException(Message); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); } var result = new CustomAttributeData[res.Count]; @@ -392,7 +391,7 @@ internal static IList GetCustomAttributesData(ICustomAttrib foreach (CustomAttributeData attrData in res) { if (attrData == null) - throw new CustomAttributeFormatException(Message); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); if (!attributeType.IsAssignableFrom(attrData.AttributeType)) continue; a.Add(attrData); @@ -413,7 +412,7 @@ internal static IList GetCustomAttributesData(ICustomAttrib { AttributeUsageAttribute usage; if (attrData == null) - throw new CustomAttributeFormatException(Message); + throw new CustomAttributeFormatException(SR.Arg_CustomAttributeFormatException); Type attrType = attrData.AttributeType; if (attributeType != null) diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs index 7c5de218b3c3c4..c5f5ea20d79141 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs @@ -336,7 +336,7 @@ internal static Type MakeGenericType(Type gtd, Type[] typeArguments) => if (res is TypeBuilder) { if (throwOnError) - throw new TypeLoadException(string.Format("Could not load type '{0}' from assembly '{1}'", name, this.name)); + throw new TypeLoadException(SR.Format(SR.ClassLoad_General, name, this.name)); return null; } return res; diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs index d6c30ccd65a8ad..0383d028a02e4b 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs @@ -319,7 +319,7 @@ internal void fixup() if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0)) { if ((ilgen == null) || (ilgen.ILOffset == 0)) - throw new InvalidOperationException("Method '" + Name + "' does not have a method body."); + throw new InvalidOperationException(SR.Format(SR.InvalidOperation_BadEmptyMethodBody, Name)); } if (IsStatic && ((call_conv & CallingConventions.VarArgs) != 0 || @@ -351,22 +351,22 @@ internal override int get_next_table_index(int table, int count) private void RejectIfCreated() { if (type.is_created) - throw new InvalidOperationException("Type definition of the method is complete."); + throw new InvalidOperationException(SR.InvalidOperation_MethodBaked); } private static Exception not_supported() { - return new NotSupportedException("The invoked member is not supported in a dynamic module."); + return new NotSupportedException(SR.NotSupported_DynamicModule); } private static Exception not_after_created() { - return new InvalidOperationException("Unable to change after type has been created."); + return new InvalidOperationException(SR.InvalidOperation_TypeHasBeenCreated); } private static Exception not_created() { - return new NotSupportedException("The type is not yet created."); + return new NotSupportedException(SR.InvalidOperation_TypeNotCreated); } } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/DerivedTypes.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/DerivedTypes.Mono.cs index 287de77ebe9f6c..c6fbbb10a2fa7e 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/DerivedTypes.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/DerivedTypes.Mono.cs @@ -453,12 +453,12 @@ protected override bool IsByRefImpl() public override Type MakeArrayType() { - throw new ArgumentException("Cannot create an array type of a byref type"); + throw new ArgumentException(SR.NotSupported_ByRefLikeArray); } public override Type MakeArrayType(int rank) { - throw new ArgumentException("Cannot create an array type of a byref type"); + throw new ArgumentException(SR.NotSupported_ByRefLikeArray); } public override Type MakeByRefType() diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs index 65fedfb5c6023b..ef7aec4fcd37d2 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs @@ -140,7 +140,7 @@ public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) private void RejectIfCreated() { if (typeb.is_created) - throw new InvalidOperationException("Type definition of the method is complete."); + throw new InvalidOperationException(SR.InvalidOperation_MethodBaked); } } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs index b113b088551b35..09c6414c44616e 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.Mono.cs @@ -170,7 +170,7 @@ public void SetConstant(object? defaultValue) RejectIfCreated(); /*if (defaultValue.GetType() != type) - throw new ArgumentException("Constant doesn't match field type");*/ + throw new ArgumentException(SR.Argument_ConstantDoesntMatch);*/ def_value = defaultValue; } @@ -248,7 +248,7 @@ private static Exception CreateNotSupportedException() private void RejectIfCreated() { if (typeb.is_created) - throw new InvalidOperationException("Unable to change after type has been created."); + throw new InvalidOperationException(SR.InvalidOperation_TypeHasBeenCreated); } internal void ResolveUserTypes() diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs index 3f7f25a4d5f74f..d756bd44aa84d5 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs @@ -346,13 +346,13 @@ private void InternalEndClause() public virtual void BeginCatchBlock(Type? exceptionType) { if (!InExceptionBlock) - throw new NotSupportedException("Not in an exception block"); + throw new NotSupportedException(SR.Argument_NotInExceptionBlock); if (exceptionType != null && exceptionType.IsUserType) throw new NotSupportedException("User defined subclasses of System.Type are not yet supported."); if (ex_handlers![cur_block].LastClauseType() == ILExceptionBlock.FILTER_START) { if (exceptionType != null) - throw new ArgumentException("Do not supply an exception type for filter clause"); + throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType); Emit(OpCodes.Endfilter); ex_handlers[cur_block].PatchFilterClause(code_len); } @@ -372,7 +372,7 @@ public virtual void BeginCatchBlock(Type? exceptionType) public virtual void BeginExceptFilterBlock() { if (!InExceptionBlock) - throw new NotSupportedException("Not in an exception block"); + throw new NotSupportedException(SR.Argument_NotInExceptionBlock); InternalEndClause(); ex_handlers![cur_block].AddFilter(code_len); @@ -403,7 +403,7 @@ public virtual Label BeginExceptionBlock() public virtual void BeginFaultBlock() { if (!InExceptionBlock) - throw new NotSupportedException("Not in an exception block"); + throw new NotSupportedException(SR.Argument_NotInExceptionBlock); if (ex_handlers![cur_block].LastClauseType() == ILExceptionBlock.FILTER_START) { @@ -419,7 +419,7 @@ public virtual void BeginFaultBlock() public virtual void BeginFinallyBlock() { if (!InExceptionBlock) - throw new NotSupportedException("Not in an exception block"); + throw new NotSupportedException(SR.Argument_NotInExceptionBlock); InternalEndClause(); @@ -719,7 +719,7 @@ public virtual void Emit(OpCode opcode, MethodInfo meth) // For compatibility with MS if ((meth is DynamicMethod) && ((opcode == OpCodes.Ldftn) || (opcode == OpCodes.Ldvirtftn) || (opcode == OpCodes.Ldtoken))) - throw new ArgumentException("Ldtoken, Ldftn and Ldvirtftn OpCodes cannot target DynamicMethods."); + throw new ArgumentException(SR.Argument_InvalidOpCodeOnDynamicMethod); int token = token_gen.GetToken(meth, true); make_room(6); @@ -790,7 +790,7 @@ public virtual void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? optio ArgumentNullException.ThrowIfNull(methodInfo); short value = opcode.Value; if (!(value == OpCodes.Call.Value || value == OpCodes.Callvirt.Value)) - throw new NotSupportedException("Only Call and CallVirt are allowed"); + throw new NotSupportedException(SR.Argument_NotMethodCallOpcode); if ((methodInfo.CallingConvention & CallingConventions.VarArgs) == 0) optionalParameterTypes = null; if (optionalParameterTypes != null) @@ -848,7 +848,7 @@ public virtual void EmitWriteLine(LocalBuilder localBuilder) { ArgumentNullException.ThrowIfNull(localBuilder); if (localBuilder.LocalType is TypeBuilder) - throw new ArgumentException("Output streams do not support TypeBuilders."); + throw new NotSupportedException(SR.NotSupported_OutputStreamUsingTypeBuilder); // The MS implementation does not check for valuetypes here but it // should. Emit(OpCodes.Ldloc, localBuilder); @@ -866,10 +866,10 @@ public virtual void EmitWriteLine(string value) public virtual void EndExceptionBlock() { if (!InExceptionBlock) - throw new NotSupportedException("Not in an exception block"); + throw new NotSupportedException(SR.Argument_NotInExceptionBlock); if (ex_handlers![cur_block].LastClauseType() == ILExceptionBlock.FILTER_START) - throw new InvalidOperationException("Incorrect code generation for exception block."); + throw new InvalidOperationException(SR.Argument_BadExceptionCodeGen); InternalEndClause(); MarkLabel(ex_handlers[cur_block].end); @@ -885,9 +885,9 @@ public virtual void EndScope() public virtual void MarkLabel(Label loc) { if (loc.m_label < 0 || loc.m_label >= num_labels) - throw new System.ArgumentException("The label is not valid"); + throw new System.ArgumentException(SR.Argument_InvalidLabel); if (labels![loc.m_label].addr >= 0) - throw new System.ArgumentException("The label was already defined"); + throw new System.ArgumentException(SR.Argument_RedefinedLabel); labels[loc.m_label].addr = code_len; if (labels[loc.m_label].maxStack > cur_stack) cur_stack = labels[loc.m_label].maxStack; @@ -898,10 +898,10 @@ public virtual void ThrowException([DynamicallyAccessedMembers(DynamicallyAccess ArgumentNullException.ThrowIfNull(excType); if (!((excType == typeof(Exception)) || excType.IsSubclassOf(typeof(Exception)))) - throw new ArgumentException("Type should be an exception type", nameof(excType)); + throw new ArgumentException(SR.Argument_NotExceptionType, nameof(excType)); ConstructorInfo? ctor = excType.GetConstructor(Type.EmptyTypes); if (ctor == null) - throw new ArgumentException("Type should have a default constructor", nameof(excType)); + throw new ArgumentException(SR.Argument_MissingDefaultConstructor, nameof(excType)); Emit(OpCodes.Newobj, ctor); Emit(OpCodes.Throw); } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs index e5b8fbeab3f6f8..3e538580420059 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs @@ -532,12 +532,12 @@ internal void set_override(MethodInfo mdecl) private void RejectIfCreated() { if (type.is_created) - throw new InvalidOperationException("Type definition of the method is complete."); + throw new InvalidOperationException(SR.InvalidOperation_MethodBaked); } private static Exception NotSupported() { - return new NotSupportedException("The invoked member is not supported in a dynamic module."); + return new NotSupportedException(SR.NotSupported_DynamicModule); } [RequiresDynamicCode("The native code for this instantiation might not be available at runtime.")] diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs index 67b975b658a57f..a1cf9e4b742364 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs @@ -123,7 +123,7 @@ public override string FullyQualifiedName public void CreateGlobalFunctions() { if (global_type_created) - throw new InvalidOperationException("global methods already created"); + throw new InvalidOperationException(SR.InvalidOperation_GlobalsHaveBeenCreated); if (global_type != null) { global_type_created = true; @@ -153,9 +153,9 @@ private FieldBuilder DefineDataImpl(string name, int size, FieldAttributes attri { ArgumentException.ThrowIfNullOrEmpty(name); if (global_type_created) - throw new InvalidOperationException("global fields already created"); + throw new InvalidOperationException(SR.InvalidOperation_GlobalsHaveBeenCreated); if ((size <= 0) || (size >= 0x3f0000)) - throw new ArgumentException("Data size must be > 0 and < 0x3f0000", null as string); + throw new ArgumentException(SR.Argument_BadSizeForData, null as string); CreateGlobalType(); @@ -204,9 +204,9 @@ public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes { ArgumentNullException.ThrowIfNull(name); if ((attributes & MethodAttributes.Static) == 0) - throw new ArgumentException("global methods must be static"); + throw new ArgumentException(SR.Argument_GlobalMembersMustBeStatic); if (global_type_created) - throw new InvalidOperationException("global methods already created"); + throw new InvalidOperationException(SR.InvalidOperation_GlobalsHaveBeenCreated); CreateGlobalType(); MethodBuilder mb = global_type!.DefineMethod(name, attributes, callingConvention, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers); @@ -219,9 +219,9 @@ public MethodBuilder DefinePInvokeMethod(string name, string dllName, string ent { ArgumentNullException.ThrowIfNull(name); if ((attributes & MethodAttributes.Static) == 0) - throw new ArgumentException("global methods must be static"); + throw new ArgumentException(SR.Argument_GlobalMembersMustBeStatic); if (global_type_created) - throw new InvalidOperationException("global methods already created"); + throw new InvalidOperationException(SR.InvalidOperation_GlobalsHaveBeenCreated); CreateGlobalType(); MethodBuilder mb = global_type!.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet); @@ -253,7 +253,7 @@ private TypeBuilder DefineType(string name, TypeAttributes attr, [DynamicallyAcc ArgumentNullException.ThrowIfNull(name, "fullname"); ITypeIdentifier ident = TypeIdentifiers.FromInternal(name); if (name_cache.ContainsKey(ident)) - throw new ArgumentException("Duplicate type name within an assembly."); + throw new ArgumentException(SR.Argument_DuplicateTypeName); TypeBuilder res = new TypeBuilder(this, name, attr, parent, interfaces, packingSize, typesize, null); AddType(res); @@ -293,7 +293,7 @@ public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type under { ITypeIdentifier ident = TypeIdentifiers.FromInternal(name); if (name_cache.ContainsKey(ident)) - throw new ArgumentException("Duplicate type name within an assembly."); + throw new ArgumentException(SR.Argument_DuplicateTypeName); EnumBuilder eb = new EnumBuilder(this, name, visibility, underlyingType); TypeBuilder res = eb.GetTypeBuilder(); diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs index 041784bdce33ee..cb6b4f4faac9c2 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs @@ -222,7 +222,7 @@ public override Module Module private static Exception not_supported() { - return new NotSupportedException("The invoked member is not supported in a dynamic module."); + return new NotSupportedException(SR.NotSupported_DynamicModule); } } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs index 45c734ef396a13..8807555a09b7d8 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs @@ -72,7 +72,7 @@ internal SignatureHelper(ModuleBuilder? module, SignatureHelperType type) public static SignatureHelper GetFieldSigHelper(Module? mod) { if (mod != null && !(mod is ModuleBuilder)) - throw new ArgumentException("ModuleBuilder is expected"); + throw new NotSupportedException(SR.NotSupported_MustBeModuleBuilder); return new SignatureHelper((ModuleBuilder?)mod, SignatureHelperType.HELPER_FIELD); } @@ -80,7 +80,7 @@ public static SignatureHelper GetFieldSigHelper(Module? mod) public static SignatureHelper GetLocalVarSigHelper(Module? mod) { if (mod != null && !(mod is ModuleBuilder)) - throw new ArgumentException("ModuleBuilder is expected"); + throw new NotSupportedException(SR.NotSupported_MustBeModuleBuilder); return new SignatureHelper((ModuleBuilder?)mod, SignatureHelperType.HELPER_LOCAL); } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs index 1615a94d9d4f5b..44e40df96a2e55 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs @@ -477,10 +477,7 @@ public ConstructorBuilder DefineDefaultConstructor(MethodAttributes attributes) null, EmptyTypes, null); if (parent_constructor == null) { - throw new NotSupportedException("Parent does" - + " not have a default constructor." - + " The default constructor must be" - + " explicitly defined."); + throw new NotSupportedException(SR.NotSupported_NoParentDefaultConstructor); } ConstructorBuilder cb = DefineConstructor(attributes, @@ -552,9 +549,9 @@ public MethodBuilder DefinePInvokeMethod( check_name(nameof(dllName), dllName); check_name(nameof(entryName), entryName); if ((attributes & MethodAttributes.Abstract) != 0) - throw new ArgumentException("PInvoke methods must be static and native and cannot be abstract."); + throw new ArgumentException(SR.Argument_BadPInvokeMethod); if (IsInterface) - throw new ArgumentException("PInvoke methods cannot exist on interfaces."); + throw new ArgumentException(SR.Argument_BadPInvokeOnInterface); check_not_created(); MethodBuilder res @@ -595,7 +592,7 @@ public FieldBuilder DefineField(string fieldName, Type type, Type[]? requiredCus { check_name(nameof(fieldName), fieldName); if (type == typeof(void)) - throw new ArgumentException("Bad field type in defining field."); + throw new ArgumentException(SR.Argument_BadFieldType); check_not_created(); FieldBuilder res = new FieldBuilder(this, fieldName, type, attributes, requiredCustomModifiers, optionalCustomModifiers); @@ -1307,11 +1304,11 @@ public override Type MakeGenericType(params Type[] typeArguments) //return base.MakeGenericType (typeArguments); if (!IsGenericTypeDefinition) - throw new InvalidOperationException("not a generic type definition"); + throw new InvalidOperationException(SR.InvalidOperation_NotGenericType); ArgumentNullException.ThrowIfNull(typeArguments); if (generic_params!.Length != typeArguments.Length) - throw new ArgumentException(string.Format("The type or method has {0} generic parameter(s) but {1} generic argument(s) where provided. A generic argument must be provided for each generic parameter.", generic_params.Length, typeArguments.Length), nameof(typeArguments)); + throw new ArgumentException(SR.Format(SR.Argument_NotEnoughGenArguments, generic_params.Length, typeArguments.Length), nameof(typeArguments)); foreach (Type t in typeArguments) { @@ -1500,7 +1497,7 @@ public FieldBuilder DefineUninitializedData(string name, int size, FieldAttribut { ArgumentException.ThrowIfNullOrEmpty(name); if ((size <= 0) || (size > 0x3f0000)) - throw new ArgumentException("Data size must be > 0 and < 0x3f0000"); + throw new ArgumentException(SR.Argument_BadSizeForData); check_not_created(); string typeName = "$ArrayType$" + size; @@ -1530,7 +1527,7 @@ public void SetParent([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes if ((attrs & TypeAttributes.Interface) != 0) { if ((attrs & TypeAttributes.Abstract) == 0) - throw new InvalidOperationException("Interface must be declared abstract."); + throw new InvalidOperationException(SR.InvalidOperation_BadInterfaceNotAbstract); this.parent = null; } else @@ -1582,7 +1579,7 @@ internal bool is_created private static Exception not_supported() { - return new NotSupportedException("The invoked member is not supported in a dynamic module."); + return new NotSupportedException(SR.NotSupported_DynamicModule); } internal void check_not_created() @@ -1661,7 +1658,7 @@ public override Type[] GetGenericArguments() public override Type GetGenericTypeDefinition() { if (generic_params == null) - throw new InvalidOperationException("Type is not generic"); + throw new InvalidOperationException(SR.InvalidOperation_NotGenericType); return this; } @@ -1963,7 +1960,7 @@ internal static bool SetConstantValue(Type destType, object? value, ref object? destValue = ticks; return true; default: - throw new ArgumentException(type!.ToString() + " is not a supported constant type."); + throw new ArgumentException(SR.Format(SR.Argument_ConstantNotSupported, type)); } } else @@ -1979,7 +1976,7 @@ internal static bool SetConstantValue(Type destType, object? value, ref object? private static void throw_argument_ConstantDoesntMatch() { - throw new ArgumentException("Constant does not match the defined type."); + throw new ArgumentException(SR.Argument_ConstantDoesntMatch); } public override bool IsTypeDefinition => true; diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs index f59e3e204b8377..43e7f5154ad9de 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs @@ -219,7 +219,7 @@ public override int MetadataToken internal static EventInfo GetEventFromHandle(Mono.RuntimeEventHandle handle, RuntimeTypeHandle reflectedType) { if (handle.Value == IntPtr.Zero) - throw new ArgumentException("The handle is invalid."); + throw new ArgumentException(SR.Argument_InvalidHandle); EventInfo ei = internal_from_handle_type(handle.Value, reflectedType.Value); if (ei == null) throw new ArgumentException("The event handle and the type handle are incompatible."); diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs index 40265d7b9a2702..96d20cf5b2bf8a 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs @@ -201,12 +201,9 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit) if (!IsStatic) { if (obj == null) - throw new TargetException("Non-static field requires a target"); + throw new TargetException(SR.RFLCT_Targ_StatFldReqTarg); if (!DeclaringType!.IsAssignableFrom(obj.GetType())) - throw new ArgumentException(string.Format( - "Field {0} defined on type {1} is not a field on the target object which is of type {2}.", - Name, DeclaringType, obj.GetType()), - nameof(obj)); + throw new ArgumentException(SR.Format(SR.Arg_FieldDeclTarget, Name, DeclaringType, obj.GetType()), nameof(obj)); } if (!IsLiteral) @@ -228,15 +225,12 @@ public override void SetValue(object? obj, object? val, BindingFlags invokeAttr, if (!IsStatic) { if (obj == null) - throw new TargetException("Non-static field requires a target"); + throw new TargetException(SR.RFLCT_Targ_StatFldReqTarg); if (!DeclaringType!.IsAssignableFrom(obj.GetType())) - throw new ArgumentException(string.Format( - "Field {0} defined on type {1} is not a field on the target object which is of type {2}.", - Name, DeclaringType, obj.GetType()), - nameof(obj)); + throw new ArgumentException(SR.Format(SR.Arg_FieldDeclTarget, Name, DeclaringType, obj.GetType()), nameof(obj)); } if (IsLiteral) - throw new FieldAccessException("Cannot set a constant field"); + throw new FieldAccessException(SR.Acc_ReadOnly); binder ??= Type.DefaultBinder; CheckGeneric(); diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs index a4ee059ee1616c..74ef00dc7f8c2b 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs @@ -370,9 +370,9 @@ internal static Exception resolve_token_exception(Module module, int metadataTok internal static Exception resolve_token_exception(string name, int metadataToken, ResolveTokenError error, string tokenType) { if (error == ResolveTokenError.OutOfRange) - return new ArgumentOutOfRangeException(nameof(metadataToken), string.Format("Token 0x{0:x} is not valid in the scope of module {1}", metadataToken, name)); + return new ArgumentOutOfRangeException(nameof(metadataToken), SR.Format(SR.Argument_InvalidToken, metadataToken, name)); else - return new ArgumentException(string.Format("Token 0x{0:x} is not a valid {1} token in the scope of module {2}", metadataToken, tokenType, name), nameof(metadataToken)); + return new ArgumentException(SR.Format(SR.Argument_ResolveType, metadataToken, tokenType, name), nameof(metadataToken)); } internal static IntPtr[]? ptrs_from_types(Type[]? types) diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs index 07c63015e4bfb4..ff88ac01ba03f6 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs @@ -256,7 +256,7 @@ int MetadataToken { return GetMetadataToken(); } - throw new ArgumentException("Can't produce MetadataToken for member of type " + MemberImpl.GetType()); + throw new ArgumentException(SR.NoMetadataTokenAvailable); } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs index fa6e1c0fc45a9c..6fa21bd6e7c2e6 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs @@ -500,7 +500,7 @@ public override int MetadataToken internal static PropertyInfo GetPropertyFromHandle(RuntimePropertyHandle handle, RuntimeTypeHandle reflectedType) { if (handle.Value == IntPtr.Zero) - throw new ArgumentException("The handle is invalid."); + throw new ArgumentException(SR.Argument_InvalidHandle); PropertyInfo pi = internal_from_handle_type(handle.Value, reflectedType.Value); if (pi == null) throw new ArgumentException("The property handle and the type handle are incompatible."); diff --git a/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs index 1025e77ebe4816..9d49d158a457f1 100644 --- a/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs @@ -65,7 +65,7 @@ public static int GetHashCode(object? o) public static void RunClassConstructor(RuntimeTypeHandle type) { if (type.Value == IntPtr.Zero) - throw new ArgumentException("Handle is not initialized.", nameof(type)); + throw new ArgumentException(SR.InvalidOperation_HandleIsNotInitialized, nameof(type)); RunClassConstructor(type.Value); } @@ -115,7 +115,7 @@ public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] public static void RunModuleConstructor(ModuleHandle module) { if (module == ModuleHandle.EmptyHandle) - throw new ArgumentException("Handle is not initialized.", nameof(module)); + throw new ArgumentException(SR.InvalidOperation_HandleIsNotInitialized, nameof(module)); RunModuleConstructor(module.Value); } diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs index a8d528460d8e28..f8cadc996373ed 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs @@ -2041,29 +2041,29 @@ private RuntimePropertyInfo[] GetPropertiesByName(string? name, BindingFlags bin } } - public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type ifaceType) + public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) { if (IsGenericParameter) throw new InvalidOperationException(SR.Arg_GenericParameter); - ArgumentNullException.ThrowIfNull(ifaceType); + ArgumentNullException.ThrowIfNull(interfaceType); - RuntimeType? ifaceRtType = ifaceType as RuntimeType; + RuntimeType? ifaceRtType = interfaceType as RuntimeType; if (ifaceRtType == null) - throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(ifaceType)); + throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(interfaceType)); InterfaceMapping res; - if (!ifaceType.IsInterface) - throw new ArgumentException("Argument must be an interface.", nameof(ifaceType)); + if (!interfaceType.IsInterface) + throw new ArgumentException(SR.Arg_MustBeInterface, nameof(interfaceType)); if (IsInterface) - throw new ArgumentException("'this' type cannot be an interface itself"); + throw new ArgumentException(SR.Argument_InterfaceMap); var this_type = this; res.TargetType = this; - res.InterfaceType = ifaceType; + res.InterfaceType = interfaceType; GetInterfaceMapData(new QCallTypeHandle(ref this_type), new QCallTypeHandle(ref ifaceRtType), out res.TargetMethods, out res.InterfaceMethods); if (res.TargetMethods == null) - throw new ArgumentException("Interface not found", nameof(ifaceType)); + throw new ArgumentException(SR.Arg_NotFoundIFace, nameof(interfaceType)); return res; } diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs index 39e4a5a9544494..4678097b3f8f71 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs @@ -124,11 +124,10 @@ internal static TypeAttributes GetAttributes(RuntimeType type) public ModuleHandle GetModuleHandle() { - // Although MS' runtime is crashing here, we prefer throwing an exception. // The check is needed because Type.GetTypeFromHandle returns null // for zero handles. if (value == IntPtr.Zero) - throw new InvalidOperationException("Object fields may not be properly initialized"); + throw new ArgumentException(SR.Arg_InvalidHandle); return Type.GetTypeFromHandle(this)!.Module.ModuleHandle; } @@ -373,7 +372,7 @@ internal static bool IsTypeDefinition(RuntimeType type) if (typeName.Length == 0) if (throwOnError) - throw new TypeLoadException("A null or zero length string does not represent a valid Type."); + throw new TypeLoadException(SR.Arg_TypeLoadNullStr); else return null; diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs index 413198df4ad480..e004a373ee7719 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs @@ -88,7 +88,7 @@ public static void PulseAll(object obj) private static void ObjPulse(object obj) { if (!Monitor_test_synchronised(obj)) - throw new SynchronizationLockException("Object is not synchronized"); + throw new SynchronizationLockException(); Monitor_pulse(obj); } @@ -99,7 +99,7 @@ private static void ObjPulse(object obj) private static void ObjPulseAll(object obj) { if (!Monitor_test_synchronised(obj)) - throw new SynchronizationLockException("Object is not synchronized"); + throw new SynchronizationLockException(); Monitor_pulse_all(obj); } @@ -112,7 +112,7 @@ private static bool ObjWait(int millisecondsTimeout, object obj) if (millisecondsTimeout < 0 && millisecondsTimeout != (int)Timeout.Infinite) throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout)); if (!Monitor_test_synchronised(obj)) - throw new SynchronizationLockException("Object is not synchronized"); + throw new SynchronizationLockException(); return Monitor_wait(obj, millisecondsTimeout, true); } diff --git a/src/mono/System.Private.CoreLib/src/System/Type.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Type.Mono.cs index 8b2009154440eb..9504643cec7081 100644 --- a/src/mono/System.Private.CoreLib/src/System/Type.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Type.Mono.cs @@ -116,17 +116,17 @@ internal virtual bool IsUserType internal virtual MethodInfo GetMethod(MethodInfo fromNoninstanciated) { - throw new InvalidOperationException("can only be called in generic type"); + throw new InvalidOperationException(SR.InvalidOperation_NotGenericType); } internal virtual ConstructorInfo GetConstructor(ConstructorInfo fromNoninstanciated) { - throw new InvalidOperationException("can only be called in generic type"); + throw new InvalidOperationException(SR.InvalidOperation_NotGenericType); } internal virtual FieldInfo GetField(FieldInfo fromNoninstanciated) { - throw new InvalidOperationException("can only be called in generic type"); + throw new InvalidOperationException(SR.InvalidOperation_NotGenericType); } [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/src/mono/System.Private.CoreLib/src/System/TypeLoadException.Mono.cs b/src/mono/System.Private.CoreLib/src/System/TypeLoadException.Mono.cs index a531a773e515bc..9f4f4ced458b04 100644 --- a/src/mono/System.Private.CoreLib/src/System/TypeLoadException.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/TypeLoadException.Mono.cs @@ -24,7 +24,7 @@ private void SetMessageField() return; } - _message = SR.Format("Could not load type '{0}' from assembly '{1}'.", _className, _assemblyName ?? SR.IO_UnknownFileName); + _message = SR.Format(SR.ClassLoad_General, _className, _assemblyName ?? SR.IO_UnknownFileName); } } }