diff options
Diffstat (limited to 'src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs')
-rw-r--r-- | src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs b/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs index ec725acad7..b592053f9f 100644 --- a/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs +++ b/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs @@ -54,7 +54,7 @@ namespace System.Reflection.Emit RuntimeType rtType = localType as RuntimeType; if (rtType == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); + throw new ArgumentException(SR.Argument_MustBeRuntimeType); localBuilder = new LocalBuilder(m_localCount, localType, m_methodBuilder); // add the localType to local signature @@ -81,7 +81,7 @@ namespace System.Reflection.Emit { RuntimeMethodInfo rtMeth = meth as RuntimeMethodInfo; if (rtMeth == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(meth)); + throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(meth)); RuntimeType declaringType = rtMeth.GetRuntimeType(); if (declaringType != null && (declaringType.IsGenericType || declaringType.IsArray)) @@ -94,7 +94,7 @@ namespace System.Reflection.Emit // rule out not allowed operations on DynamicMethods if (opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn) || opcode.Equals(OpCodes.Ldvirtftn)) { - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOpCodeOnDynamicMethod")); + throw new ArgumentException(SR.Argument_InvalidOpCodeOnDynamicMethod); } token = GetTokenFor(dynMeth); } @@ -132,7 +132,7 @@ namespace System.Reflection.Emit RuntimeConstructorInfo rtConstructor = con as RuntimeConstructorInfo; if (rtConstructor == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(con)); + throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(con)); RuntimeType declaringType = rtConstructor.GetRuntimeType(); int token; @@ -161,7 +161,7 @@ namespace System.Reflection.Emit RuntimeType rtType = type as RuntimeType; if (rtType == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); + throw new ArgumentException(SR.Argument_MustBeRuntimeType); int token = GetTokenFor(rtType); EnsureCapacity(7); @@ -177,7 +177,7 @@ namespace System.Reflection.Emit RuntimeFieldInfo runtimeField = field as RuntimeFieldInfo; if (runtimeField == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeFieldInfo"), nameof(field)); + throw new ArgumentException(SR.Argument_MustBeRuntimeFieldInfo, nameof(field)); int token; if (field.DeclaringType == null) @@ -218,7 +218,7 @@ namespace System.Reflection.Emit if (optionalParameterTypes != null) if ((callingConvention & CallingConventions.VarArgs) == 0) - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAVarArgCallingConvention")); + throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention); sig = GetMemberRefSignature(callingConvention, returnType, @@ -254,13 +254,13 @@ namespace System.Reflection.Emit throw new ArgumentNullException(nameof(methodInfo)); if (!(opcode.Equals(OpCodes.Call) || opcode.Equals(OpCodes.Callvirt) || opcode.Equals(OpCodes.Newobj))) - throw new ArgumentException(Environment.GetResourceString("Argument_NotMethodCallOpcode"), nameof(opcode)); + throw new ArgumentException(SR.Argument_NotMethodCallOpcode, nameof(opcode)); if (methodInfo.ContainsGenericParameters) - throw new ArgumentException(Environment.GetResourceString("Argument_GenericsInvalid"), nameof(methodInfo)); + throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(methodInfo)); if (methodInfo.DeclaringType != null && methodInfo.DeclaringType.ContainsGenericParameters) - throw new ArgumentException(Environment.GetResourceString("Argument_GenericsInvalid"), nameof(methodInfo)); + throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(methodInfo)); Contract.EndContractBlock(); int tk; @@ -328,7 +328,7 @@ namespace System.Reflection.Emit // Begins an exception filter block. Emits a branch instruction to the end of the current exception block. if (CurrExcStackCount == 0) - throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock")); + throw new NotSupportedException(SR.Argument_NotInExceptionBlock); __ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1]; @@ -342,7 +342,7 @@ namespace System.Reflection.Emit public override void BeginCatchBlock(Type exceptionType) { if (CurrExcStackCount == 0) - throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock")); + throw new NotSupportedException(SR.Argument_NotInExceptionBlock); Contract.EndContractBlock(); __ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1]; @@ -353,7 +353,7 @@ namespace System.Reflection.Emit { if (exceptionType != null) { - throw new ArgumentException(Environment.GetResourceString("Argument_ShouldNotSpecifyExceptionType")); + throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType); } this.Emit(OpCodes.Endfilter); @@ -367,7 +367,7 @@ namespace System.Reflection.Emit throw new ArgumentNullException(nameof(exceptionType)); if (rtType == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); + throw new ArgumentException(SR.Argument_MustBeRuntimeType); Label endLabel = current.GetEndLabel(); this.Emit(OpCodes.Leave, endLabel); @@ -392,7 +392,7 @@ namespace System.Reflection.Emit [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. public override void UsingNamespace(String ns) { - throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod")); + throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod); } [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. @@ -402,17 +402,17 @@ namespace System.Reflection.Emit int endLine, int endColumn) { - throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod")); + throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod); } public override void BeginScope() { - throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod")); + throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod); } public override void EndScope() { - throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod")); + throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod); } private int GetMemberRefToken(MethodBase methodInfo, Type[] optionalParameterTypes) @@ -420,13 +420,13 @@ namespace System.Reflection.Emit Type[] parameterTypes; if (optionalParameterTypes != null && (methodInfo.CallingConvention & CallingConventions.VarArgs) == 0) - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAVarArgCallingConvention")); + throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention); RuntimeMethodInfo rtMeth = methodInfo as RuntimeMethodInfo; DynamicMethod dm = methodInfo as DynamicMethod; if (rtMeth == null && dm == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(methodInfo)); + throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(methodInfo)); ParameterInfo[] paramInfo = methodInfo.GetParametersNoCopy(); if (paramInfo != null && paramInfo.Length != 0) @@ -953,7 +953,7 @@ namespace System.Reflection.Emit Type t = m.DeclaringType.GetGenericTypeDefinition(); throw new ArgumentException(String.Format( - CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGenericLcg"), m, t)); + CultureInfo.CurrentCulture, SR.Argument_MethodDeclaringTypeGenericLcg, m, t)); } } |