Port Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString() (#1911)
authorCharles Stoner <chucks@microsoft.com>
Tue, 28 Jan 2020 06:37:41 +0000 (22:37 -0800)
committerGitHub <noreply@github.com>
Tue, 28 Jan 2020 06:37:41 +0000 (22:37 -0800)
42 files changed:
src/libraries/Microsoft.VisualBasic.Core/ref/Microsoft.VisualBasic.Core.cs
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/ByteType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/CharArrayType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/CharType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Conversions.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/DateType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/ExceptionUtils.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/IOUtils.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/IntegerType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/LateBinding.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/LikeOperator.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/LongType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/NewLateBinding.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/ObjectFlowControl.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/ObjectType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Operators.Resolution.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Operators.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/OverloadResolution.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/ProjectData.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/ShortType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/SingleType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/StringType.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Symbols.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Utils.LateBinder.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Utils.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/VB6BinaryFile.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/VB6File.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/VB6RandomFile.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/VBBinder.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Versioned.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/Conversion.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/DateAndTime.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/ErrObject.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/FileSystem.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/MalformedLineException.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/SpecialDirectories.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileSystem.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/Financial.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/Interaction.vb
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/Strings.vb
src/libraries/Microsoft.VisualBasic.Core/tests/UtilsTests.cs

index 0993504..d1da2fc 100644 (file)
@@ -1098,6 +1098,7 @@ namespace Microsoft.VisualBasic.CompilerServices
     {
         internal Utils() { }
         public static System.Array CopyArray(System.Array arySrc, System.Array aryDest) { throw null; }
+        public static string GetResourceString(string ResourceKey, params string[] Args) { throw null; }
     }
     [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
     public sealed partial class Versioned
index c6829a4..c49309e 100644 (file)
@@ -31,7 +31,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Return CByte(DoubleType.Parse(Value))
 
             Catch e As FormatException
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Byte"), e)  'UNSIGNED: make these strings constants
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Byte"), e)  'UNSIGNED: make these strings constants
             End Try
 
         End Function
@@ -115,7 +115,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             End Select
 
 ThrowInvalidCast:
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Byte"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Byte"))
 
         End Function
 
index 8417ea2..f6b4108 100644 (file)
@@ -46,7 +46,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
             End If
 
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Char()"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Char()"))
 
         End Function
 
index adf97b2..6e76e76 100644 (file)
@@ -60,7 +60,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 End Select
             End If
 
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Char"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Char"))
         End Function
 
     End Class
index 249d7a0..67ba5ce 100644 (file)
@@ -2638,7 +2638,7 @@ MisMatch:
 
                 ElseIf Result = ConversionClass.Ambiguous Then
                     Throw New InvalidCastException(
-                        GetResourceString(
+                        SR.Format(
                             SR.AmbiguousCast2,
                             VBFriendlyName(SourceType),
                             VBFriendlyName(TargetType)))
@@ -2647,7 +2647,7 @@ MisMatch:
             End If
 
             Throw New InvalidCastException(
-                GetResourceString(
+                SR.Format(
                     SR.InvalidCast_FromTo,
                     VBFriendlyName(SourceType),
                     VBFriendlyName(TargetType)))
index f61e5e3..571a651 100644 (file)
@@ -25,7 +25,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Return ParsedDate
             Else
                 'Truncate the string to 32 characters for the message
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Date"))
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Date"))
             End If
         End Function
 
@@ -68,7 +68,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
             End If
 
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Date"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Date"))
         End Function
 
         Friend Shared Function TryParse(ByVal Value As String, ByRef Result As System.DateTime) As Boolean
index 78ac8d5..b215e8c 100644 (file)
@@ -174,11 +174,11 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Friend Const DISP_E_NOTACOLLECTION As Integer = &H80020011I
 
         Friend Shared Function VbMakeIllegalForException() As System.Exception
-            Return VbMakeExceptionEx(vbErrors.IllegalFor, GetResourceString(SR.ID92)) ' 92 - IllegaFor
+            Return VbMakeExceptionEx(vbErrors.IllegalFor, SR.Format(SR.ID92)) ' 92 - IllegaFor
         End Function
 
         Friend Shared Function VbMakeObjNotSetException() As System.Exception
-            Return VbMakeExceptionEx(vbErrors.ObjNotSet, GetResourceString(SR.ID91)) ' 91 - ObjNotSet
+            Return VbMakeExceptionEx(vbErrors.ObjNotSet, SR.Format(SR.ID91)) ' 91 - ObjNotSet
         End Function
 
         Friend Shared Function VbMakeException(ByVal hr As Integer) As System.Exception
@@ -215,15 +215,15 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 Case vbErrors.None
 
-                Case vbErrors.ReturnWOGoSub, _
-                    vbErrors.ResumeWOErr, _
-                    vbErrors.CantUseNull, _
+                Case vbErrors.ReturnWOGoSub,
+                    vbErrors.ResumeWOErr,
+                    vbErrors.CantUseNull,
                     vbErrors.DoesntImplementICollection
                     Return New InvalidOperationException(Description)
 
-                Case vbErrors.IllegalFuncCall, _
-                    vbErrors.NamedParamNotFound, _
-                    vbErrors.NamedArgsNotSupported, _
+                Case vbErrors.IllegalFuncCall,
+                    vbErrors.NamedParamNotFound,
+                    vbErrors.NamedArgsNotSupported,
                     vbErrors.ParameterNotOptional
                     Return New ArgumentException(Description)
 
@@ -257,23 +257,23 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Case vbErrors.EndOfFile
                     Return New IO.EndOfStreamException(Description)
 
-                Case vbErrors.IOError, _
-                    vbErrors.BadFileNameOrNumber, _
-                    vbErrors.BadFileMode, _
-                    vbErrors.FileAlreadyOpen, _
-                    vbErrors.FileAlreadyExists, _
-                    vbErrors.BadRecordLen, _
-                    vbErrors.DiskFull, _
-                    vbErrors.BadRecordNum, _
-                    vbErrors.TooManyFiles, _
-                    vbErrors.DevUnavailable, _
-                    vbErrors.PermissionDenied, _
-                    vbErrors.DiskNotReady, _
-                    vbErrors.DifferentDrive, _
+                Case vbErrors.IOError,
+                    vbErrors.BadFileNameOrNumber,
+                    vbErrors.BadFileMode,
+                    vbErrors.FileAlreadyOpen,
+                    vbErrors.FileAlreadyExists,
+                    vbErrors.BadRecordLen,
+                    vbErrors.DiskFull,
+                    vbErrors.BadRecordNum,
+                    vbErrors.TooManyFiles,
+                    vbErrors.DevUnavailable,
+                    vbErrors.PermissionDenied,
+                    vbErrors.DiskNotReady,
+                    vbErrors.DifferentDrive,
                     vbErrors.PathFileAccess
                     Return New IO.IOException(Description)
 
-                Case vbErrors.PathNotFound, _
+                Case vbErrors.PathNotFound,
                     vbErrors.OLEFileNotFound
                     Return New IO.FileNotFoundException(Description)
 
@@ -283,7 +283,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Case vbErrors.PropertyNotFound
                     Return New MissingFieldException(Description)
 
-                Case vbErrors.CantCreateObject, _
+                Case vbErrors.CantCreateObject,
                     vbErrors.ServerNotFound
                     Return New Exception(Description)
 
@@ -298,7 +298,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
             VBDefinedError = False
             Return New Exception(Description)
-        
+
         End Function
 
         ''' <summary>
@@ -312,7 +312,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Friend Shared Function GetArgumentExceptionWithArgName(ByVal ArgumentName As String,
             ByVal ResourceID As String, ByVal ParamArray PlaceHolders() As String) As ArgumentException
 
-            Return New ArgumentException(GetResourceString(ResourceID, PlaceHolders), ArgumentName)
+            Return New ArgumentException(SR.Format(ResourceID, PlaceHolders), ArgumentName)
         End Function
 
         ''' <summary>
@@ -322,7 +322,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         ''' <returns>A new instance of ArgumentNullException.</returns>
         Friend Shared Function GetArgumentNullException(ByVal ArgumentName As String) As ArgumentNullException
 
-            Return New ArgumentNullException(ArgumentName, GetResourceString(SR.General_ArgumentNullException))
+            Return New ArgumentNullException(ArgumentName, SR.General_ArgumentNullException)
         End Function
 
         ''' <summary>
@@ -335,7 +335,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Friend Shared Function GetArgumentNullException(ByVal ArgumentName As String,
             ByVal ResourceID As String, ByVal ParamArray PlaceHolders() As String) As ArgumentNullException
 
-            Return New ArgumentNullException(ArgumentName, GetResourceString(ResourceID, PlaceHolders))
+            Return New ArgumentNullException(ArgumentName, SR.Format(ResourceID, PlaceHolders))
         End Function
 
         ''' <summary>
@@ -347,7 +347,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Friend Shared Function GetDirectoryNotFoundException(
             ByVal ResourceID As String, ByVal ParamArray PlaceHolders() As String) As IO.DirectoryNotFoundException
 
-            Return New IO.DirectoryNotFoundException(GetResourceString(ResourceID, PlaceHolders))
+            Return New IO.DirectoryNotFoundException(SR.Format(ResourceID, PlaceHolders))
         End Function
 
         ''' <summary>
@@ -360,7 +360,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Friend Shared Function GetFileNotFoundException(ByVal FileName As String,
             ByVal ResourceID As String, ByVal ParamArray PlaceHolders() As String) As IO.FileNotFoundException
 
-            Return New IO.FileNotFoundException(GetResourceString(ResourceID, PlaceHolders), FileName)
+            Return New IO.FileNotFoundException(SR.Format(ResourceID, PlaceHolders), FileName)
         End Function
 
         ''' <summary>
@@ -372,7 +372,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Friend Shared Function GetInvalidOperationException(
             ByVal ResourceID As String, ByVal ParamArray PlaceHolders() As String) As InvalidOperationException
 
-            Return New InvalidOperationException(GetResourceString(ResourceID, PlaceHolders))
+            Return New InvalidOperationException(SR.Format(ResourceID, PlaceHolders))
         End Function
 
         ''' <summary>
@@ -383,7 +383,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         ''' <returns>A new instance of IO.IOException.</returns>
         Friend Shared Function GetIOException(ByVal ResourceID As String, ByVal ParamArray PlaceHolders() As String) As IO.IOException
 
-            Return New IO.IOException(GetResourceString(ResourceID, PlaceHolders))
+            Return New IO.IOException(SR.Format(ResourceID, PlaceHolders))
         End Function
 
         ''' <summary>
@@ -397,7 +397,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Friend Shared Function GetWin32Exception(
             ByVal ResourceID As String, ByVal ParamArray PlaceHolders() As String) As ComponentModel.Win32Exception
 
-            Return New ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error(), GetResourceString(ResourceID, PlaceHolders))
+            Return New ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error(), SR.Format(ResourceID, PlaceHolders))
         End Function
 
     End Class
@@ -415,7 +415,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
         ' default constructor
         Public Sub New()
-            MyBase.New(GetResourceString(SR.InternalError_VisualBasicRuntime))
+            MyBase.New(SR.InternalError_VisualBasicRuntime)
         End Sub
 
     End Class
index 95e83cf..d5ed176 100644 (file)
@@ -97,7 +97,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             oAssemblyData = ProjectData.GetProjectData().GetAssemblyData(assem)
 
             If oAssemblyData.m_DirFiles Is Nothing Then
-                Throw New ArgumentException(GetResourceString(SR.DIR_IllegalCall))
+                Throw New ArgumentException(SR.DIR_IllegalCall)
             End If
 
             If oAssemblyData.m_DirNextFileIndex > oAssemblyData.m_DirFiles.GetUpperBound(0) Then
index b47dde6..ebd2025 100644 (file)
@@ -31,7 +31,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Return CInt(DoubleType.Parse(Value))
 
             Catch e As FormatException
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Integer"), e)
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Integer"), e)
             End Try
 
         End Function
@@ -114,7 +114,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     ' Fall through to error
             End Select
 ThrowInvalidCast:
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Integer"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Integer"))
         End Function
 
         Private Shared Function DecimalToInteger(ByVal ValueInterface As IConvertible) As Integer
index f2e008e..9e92421 100644 (file)
@@ -156,7 +156,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                         oTmp = Nothing
                     End Try
                     If oTmp Is Nothing Then
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
                     Else
                         Try
                             Return LateIndexGet(oTmp, args, paramnames)
@@ -165,7 +165,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                         End Try
                     End If
                 Else
-                    Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                    Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
                 End If
 
             Catch ex As TargetInvocationException
@@ -217,7 +217,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If RValueBase AndAlso objType.IsValueType Then
                     'note that objType is passed byref to InternalLateSet and that it 
                     'should be valid by the time we get to this point
-                    Throw New Exception(GetResourceString(SR.RValueBaseForValueType, VBFriendlyName(objType, o), VBFriendlyName(objType, o)))
+                    Throw New Exception(SR.Format(SR.RValueBaseForValueType, VBFriendlyName(objType, o), VBFriendlyName(objType, o)))
                 End If
             Catch ex As System.MissingMemberException When OptimisticSet = True
                 'A missing member exception means it has no Set member.  Silently handle the exception.
@@ -290,12 +290,12 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     Dim NewValue As Object
 
                     If fi.IsInitOnly Then
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_ReadOnlyField2, name, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_ReadOnlyField2, name, VBFriendlyName(objType, o)))
                     End If
 
                     If (args Is Nothing OrElse args.Length = 0) Then
                         'Everything must be shadowed
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
 
                     ElseIf args.Length = 1 Then
                         NewValue = args(0)
@@ -429,7 +429,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     End Try
 
                     If oTmp Is Nothing Then
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
                     Else
                         Try
                             LateIndexSet(oTmp, args, paramnames)
@@ -438,7 +438,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                         End Try
                     End If
                 Else
-                    Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                    Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
                 End If
 
             Catch ex As TargetInvocationException
@@ -447,10 +447,10 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 ElseIf TypeOf ex.InnerException Is TargetParameterCountException Then
                     If (flags And BindingFlags.PutRefDispProperty) <> 0 Then
                         'Set was being called
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberSetNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberSetNotFoundOnType2, name, VBFriendlyName(objType, o)))
                     Else
                         'Let was being called
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberLetNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberLetNotFoundOnType2, name, VBFriendlyName(objType, o)))
                     End If
                 Else
                     Throw ex.InnerException
@@ -468,7 +468,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             If objType.BaseType.FullName = "System.__ComObject" Then
                 Return
             End If
-            Throw New InvalidOperationException(GetResourceString(SR.LateboundCallToInheritedComClass))
+            Throw New InvalidOperationException(SR.LateboundCallToInheritedComClass)
 
         End Sub
 
@@ -491,7 +491,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 'Named arguments are not allowed as indexers        
                 If paramnames IsNot Nothing AndAlso paramnames.Length <> 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNamedArgs))
+                    Throw New ArgumentException(SR.Argument_InvalidNamedArgs)
                 End If
 
                 Dim ArgCount As Integer
@@ -564,7 +564,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                     'Catch the missing method here, Invoke below will throw an ArgumentException
                     If members Is Nothing Or iNext = 0 Then
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
                     End If
                     match = New MethodBase(iNext - 1) {}
                     For i = 0 To iNext - 1
@@ -628,7 +628,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     End If
 
                 Catch ex As Exception When IsMissingMemberException(ex)
-                    Throw New MissingMemberException(GetResourceString(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
+                    Throw New MissingMemberException(SR.Format(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
 
                 Catch ex As TargetInvocationException
                     Throw ex.InnerException
@@ -697,7 +697,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 LateIndexSet(o, args, paramnames)
 
                 If RValueBase AndAlso o.GetType().IsValueType Then
-                    Throw New Exception(GetResourceString(SR.RValueBaseForValueType, o.GetType().Name, o.GetType().Name))
+                    Throw New Exception(SR.Format(SR.RValueBaseForValueType, o.GetType().Name, o.GetType().Name))
                 End If
             Catch ex As System.MissingMemberException When OptimisticSet = True
                 'A missing member exception means it has no Set member.  Silently handle the exception.
@@ -722,7 +722,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 'Named arguments are not allowed as indexers        
                 If paramnames IsNot Nothing AndAlso paramnames.Length <> 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNamedArgs))
+                    Throw New ArgumentException(SR.Argument_InvalidNamedArgs)
                 End If
 
                 Dim ArgCount As Integer
@@ -810,7 +810,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                     'Catch the missing method here, Invoke below will throw an ArgumentException
                     If members Is Nothing Or iNext = 0 Then
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
                     End If
 
                     match = New MethodBase(iNext - 1) {}
@@ -870,7 +870,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 Catch ex As Exception When IsMissingMemberException(ex)
                     'Override the message so that we're consistent with above Throw
-                    Throw New MissingMemberException(GetResourceString(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
+                    Throw New MissingMemberException(SR.Format(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType, o)))
 
                 Catch ex As TargetInvocationException
                     Throw ex.InnerException
@@ -943,11 +943,11 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 mi = GetMembersByName(objIReflect, name, flags)
 
                 If (mi Is Nothing) OrElse (mi.Length = 0) Then
-                    Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                    Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
                 End If
                 If MemberIsField(mi) Then
                     'This expression is not a procedure, but occurs as the target of a procedure call.
-                    Throw New ArgumentException(GetResourceString(SR.ExpressionNotProcedure, name, VBFriendlyName(objType, o)))
+                    Throw New ArgumentException(SR.Format(SR.ExpressionNotProcedure, name, VBFriendlyName(objType, o)))
                 End If
 
                 'Try a FastCall
@@ -961,7 +961,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     If member.MemberType = MemberTypes.Property Then
                         member = CType(member, PropertyInfo).GetGetMethod()
                         If member Is Nothing Then
-                            Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                            Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
                         End If
                     End If
 
@@ -1004,7 +1004,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 'Some exceptions can occur that need to be mapped to MissingMemberException
             Catch ex As Exception When IsMissingMemberException(ex)
-                Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
+                Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType, o)))
 
             Catch ex As TargetInvocationException
                 Throw ex.InnerException
@@ -1182,7 +1182,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If Not IsStatic Then
                     'Reference to non-shared member '|1' requires an object reference.
                     Throw New NullReferenceException(
-                        GetResourceString(SR.NullReference_InstanceReqToAccessMember1, MemberToString(Member)))
+                        SR.Format(SR.NullReference_InstanceReqToAccessMember1, MemberToString(Member)))
                 End If
             End If
         End Sub
index c5dea23..d2a6d9b 100644 (file)
@@ -332,7 +332,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                             Options)
 
                         If RangePatternError Then
-                            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Pattern"))
+                            Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Pattern"))
                         End If
 
                         If RangeMismatch Then
@@ -362,7 +362,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                             Options)
 
                         If AsteriskPatternError Then
-                            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Pattern"))
+                            Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Pattern"))
                         End If
 
                         Return Not AsteriskMismatch
index 88cd3e4..ca76b1d 100644 (file)
@@ -34,7 +34,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
 
             Catch e As FormatException
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Long"), e)
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Long"), e)
             End Try
 
         End Function
@@ -117,7 +117,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     ' Fall through to error
             End Select
 ThrowInvalidCast:
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Long"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Long"))
         End Function
 
         Private Shared Function DecimalToLong(ByVal ValueInterface As IConvertible) As Long
index 4671f0a..0677801 100644 (file)
@@ -283,7 +283,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     failure = ResolutionFailure.InvalidArgument
 
                     If reportErrors Then
-                        Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNamedArgs))
+                        Throw New ArgumentException(SR.Argument_InvalidNamedArgs)
                     End If
 
                     Return Nothing
@@ -409,7 +409,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
             If members(0).MemberType = MemberTypes.Field Then
                 If typeArguments.Length > 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                    Throw New ArgumentException(SR.Argument_InvalidValue)
                 End If
 
                 Dim fieldValue As Object = baseReference.GetFieldValue(DirectCast(members(0), FieldInfo))
@@ -424,7 +424,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
             If argumentNames.Length > arguments.Length OrElse
                (copyBack IsNot Nothing AndAlso copyBack.Length <> arguments.Length) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                Throw New ArgumentException(SR.Argument_InvalidValue)
             End If
 
             Dim failure As OverloadResolution.ResolutionFailure
@@ -465,7 +465,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     'For backwards compatibility, throw a missing member exception if the intermediate result is Nothing.
                     If result Is Nothing Then
                         Throw New MissingMemberException(
-                                GetResourceString(
+                                SR.Format(
                                     SR.IntermediateLateBoundNothingResult1,
                                     targetProcedure.ToString,
                                     baseReference.VBFriendlyName))
@@ -621,7 +621,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 'This is an array lookup and assignment o(a) = v.
 
                 If argumentNames.Length > 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNamedArgs))
+                    Throw New ArgumentException(SR.Argument_InvalidNamedArgs)
                 End If
 
                 baseReference.SetArrayValue(arguments)
@@ -629,12 +629,12 @@ Namespace Microsoft.VisualBasic.CompilerServices
             End If
 
             If argumentNames.Length > arguments.Length Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                Throw New ArgumentException(SR.Argument_InvalidValue)
             End If
 
             If arguments.Length < 1 Then
                 'We're binding to a Set, we must have at least the Value argument.
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                Throw New ArgumentException(SR.Argument_InvalidValue)
             End If
 
             Dim methodName As String = ""
@@ -660,7 +660,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 If rValueBase AndAlso baseReference.IsValueType Then
                     Throw New Exception(
-                            GetResourceString(
+                            SR.Format(
                                 SR.RValueBaseForValueType,
                                 baseReference.VBFriendlyName,
                                 baseReference.VBFriendlyName))
@@ -915,13 +915,13 @@ Namespace Microsoft.VisualBasic.CompilerServices
             If members(0).MemberType = MemberTypes.Field Then
 
                 If TypeArguments.Length > 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                    Throw New ArgumentException(SR.Argument_InvalidValue)
                 End If
 
                 If Arguments.Length = 1 Then
                     If RValueBase AndAlso baseReference.IsValueType Then
                         Throw New Exception(
-                                GetResourceString(
+                                SR.Format(
                                     SR.RValueBaseForValueType,
                                     baseReference.VBFriendlyName,
                                     baseReference.VBFriendlyName))
@@ -940,7 +940,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             invocationFlags = BindingFlagsSetProperty
 
             If ArgumentNames.Length > Arguments.Length Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                Throw New ArgumentException(SR.Argument_InvalidValue)
             End If
 
             Dim failure As OverloadResolution.ResolutionFailure
@@ -963,7 +963,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If failure = OverloadResolution.ResolutionFailure.None Then
                     If RValueBase AndAlso baseReference.IsValueType Then
                         Throw New Exception(
-                                GetResourceString(
+                                SR.Format(
                                     SR.RValueBaseForValueType,
                                     baseReference.VBFriendlyName,
                                     baseReference.VBFriendlyName))
@@ -999,7 +999,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     'For backwards compatibility, throw a missing member exception if the intermediate result is Nothing.
                     If result Is Nothing Then
                         Throw New MissingMemberException(
-                                GetResourceString(
+                                SR.Format(
                                     SR.IntermediateLateBoundNothingResult1,
                                     targetProcedure.ToString,
                                     baseReference.VBFriendlyName))
@@ -1136,7 +1136,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 failure = ResolutionFailure.InvalidArgument
 
                 If reportErrors Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                    Throw New ArgumentException(SR.Argument_InvalidValue)
                 End If
 
                 Return Nothing
@@ -1147,7 +1147,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 If reportErrors Then
                     'If we're binding to a Set, we must have at least the Value argument.
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                    Throw New ArgumentException(SR.Argument_InvalidValue)
                 End If
 
                 Return Nothing
@@ -1201,11 +1201,11 @@ Namespace Microsoft.VisualBasic.CompilerServices
             If HasFlag(flags, BindingFlagsSetProperty) Then
                 Debug.Assert(targetProcedure.AsProperty.GetSetMethod Is Nothing, "expected error condition")
                 Return New MissingMemberException(
-                    GetResourceString(SR.NoSetProperty1, targetProcedure.AsProperty.Name))
+                    SR.Format(SR.NoSetProperty1, targetProcedure.AsProperty.Name))
             Else
                 Debug.Assert(targetProcedure.AsProperty.GetGetMethod Is Nothing, "expected error condition")
                 Return New MissingMemberException(
-                    GetResourceString(SR.NoGetProperty1, targetProcedure.AsProperty.Name))
+                    SR.Format(SR.NoGetProperty1, targetProcedure.AsProperty.Name))
             End If
         End Function
 
@@ -1238,7 +1238,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If reportErrors Then
                     'This expression is not a procedure, but occurs as the target of a procedure call.
                     Throw New ArgumentException(
-                        GetResourceString(SR.ExpressionNotProcedure, methodName, baseReference.VBFriendlyName))
+                        SR.Format(SR.ExpressionNotProcedure, methodName, baseReference.VBFriendlyName))
                 End If
                 Return Nothing
             End If
@@ -1256,7 +1256,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                     If reportErrors Then
                         Throw New InvalidCastException(
-                            GetResourceString(SR.PropertySetMissingArgument1, methodName))
+                            SR.Format(SR.PropertySetMissingArgument1, methodName))
                     End If
 
                     Return Nothing
@@ -1317,7 +1317,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                             errorMessage &= vbCrLf & "    " & errorString
                         Next
 
-                        errorMessage = GetResourceString(SR.MatchArgumentFailure2, resolutionResult.ToString, errorMessage)
+                        errorMessage = SR.Format(SR.MatchArgumentFailure2, resolutionResult.ToString, errorMessage)
                         'We are missing a member which can match the arguments, so throw a missing member exception.
                         'The InvalidCastException is thrown only for back compat.  It would
                         'be nice if the latebinder had its own set of exceptions to throw.
@@ -1348,7 +1348,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     If reportErrors Then
                         'Methods can't be targets of assignments.
                         Throw New MissingMemberException(
-                            GetResourceString(SR.MethodAssignment1, resolutionResult.AsMethod.Name))
+                            SR.Format(SR.MethodAssignment1, resolutionResult.AsMethod.Name))
                     End If
                     Return Nothing
                 End If
@@ -1393,7 +1393,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                             errorMessage &= vbCrLf & "    " & errorString
                         Next
 
-                        errorMessage = GetResourceString(SR.MatchArgumentFailure2, resolutionResult.ToString, errorMessage)
+                        errorMessage = SR.Format(SR.MatchArgumentFailure2, resolutionResult.ToString, errorMessage)
                         'The selected member can't handle the type of the Value argument, so this is an argument exception.
                         'The InvalidCastException is thrown only for back compat.  It would
                         'be nice if the latebinder had its own set of exceptions to throw.
index 790d614..9902ac2 100644 (file)
@@ -25,7 +25,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Public Shared Sub CheckForSyncLockOnValueType(ByVal Expression As Object)
             If Expression IsNot Nothing AndAlso Expression.GetType.IsValueType() Then
                 Throw New ArgumentException(
-                    GetResourceString(SR.SyncLockRequiresReferenceType1, VBFriendlyName(Expression.GetType)))
+                    SR.Format(SR.SyncLockRequiresReferenceType1, VBFriendlyName(Expression.GetType)))
             End If
         End Sub
 
@@ -84,7 +84,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Catch ex As OutOfMemoryException
                     Throw ex
                 Catch
-                    Throw New ArgumentException(GetResourceString(SR.ForLoop_ConvertToType3, elementName, VBFriendlyName(sourceType), VBFriendlyName(targetType)))
+                    Throw New ArgumentException(SR.Format(SR.ForLoop_ConvertToType3, elementName, VBFriendlyName(sourceType), VBFriendlyName(targetType)))
                 End Try
             End Function
 
@@ -96,7 +96,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Dim operatorMethod As Method = Operators.GetCallableUserDefinedOperator(op, forLoopArgument, forLoopArgument)
 
                 If operatorMethod Is Nothing Then
-                    Throw New ArgumentException(GetResourceString(
+                    Throw New ArgumentException(SR.Format(
                         SR.ForLoop_OperatorRequired2,
                         VBFriendlyNameOfType(forLoopArgumentType, fullName:=True),
                         Symbols.OperatorNames(op)))
@@ -112,7 +112,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                             parameters(0).ParameterType IsNot forLoopArgumentType OrElse
                             parameters(1).ParameterType IsNot forLoopArgumentType OrElse
                             operatorInfo.ReturnType IsNot forLoopArgumentType Then
-                            Throw New ArgumentException(GetResourceString(
+                            Throw New ArgumentException(SR.Format(
                                 SR.ForLoop_UnacceptableOperator2,
                                 operatorMethod.ToString,
                                 VBFriendlyNameOfType(forLoopArgumentType, fullName:=True)))
@@ -122,7 +122,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                         If parameters.Length <> 2 OrElse
                             parameters(0).ParameterType IsNot forLoopArgumentType OrElse
                             parameters(1).ParameterType IsNot forLoopArgumentType Then
-                            Throw New ArgumentException(GetResourceString(
+                            Throw New ArgumentException(SR.Format(
                                 SR.ForLoop_UnacceptableRelOperator2,
                                 operatorMethod.ToString,
                                 VBFriendlyNameOfType(forLoopArgumentType, fullName:=True)))
@@ -136,11 +136,11 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Dim loopFor As ForLoopControl
 
                 If (Start Is Nothing) Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNullValue1, "Start"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidNullValue1, "Start"))
                 ElseIf (Limit Is Nothing) Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNullValue1, "Limit"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidNullValue1, "Limit"))
                 ElseIf (StepValue Is Nothing) Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNullValue1, "Step"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidNullValue1, "Step"))
                 End If
 
                 Dim startType As Type = Start.GetType()
@@ -150,7 +150,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Dim widestType As Type = GetWidestType(stepType, startType, limitType)
 
                 If widestType Is Nothing Then
-                    Throw New ArgumentException(GetResourceString(SR.ForLoop_CommonType3, VBFriendlyName(startType), VBFriendlyName(limitType), VBFriendlyName(StepValue)))
+                    Throw New ArgumentException(SR.Format(SR.ForLoop_CommonType3, VBFriendlyName(startType), VBFriendlyName(limitType), VBFriendlyName(StepValue)))
                 End If
 
                 loopFor = New ForLoopControl
@@ -247,7 +247,7 @@ NotEnumType:
                 End If
 
                 If Counter Is Nothing Then
-                    Throw New NullReferenceException(GetResourceString(SR.Argument_InvalidNullValue1, "Counter"))
+                    Throw New NullReferenceException(SR.Format(SR.Argument_InvalidNullValue1, "Counter"))
                 End If
 
                 loopFor = CType(LoopObj, ForLoopControl)
@@ -260,7 +260,7 @@ NotEnumType:
 
                     If counterTypeCode <> loopFor._widestTypeCode OrElse counterTypeCode = TypeCode.String Then
                         If counterTypeCode = TypeCode.Object Then
-                            Throw New ArgumentException(GetResourceString(SR.ForLoop_CommonType2, VBFriendlyName(MapTypeCodeToType(counterTypeCode)), VBFriendlyName(loopFor._widestType)))
+                            Throw New ArgumentException(SR.Format(SR.ForLoop_CommonType2, VBFriendlyName(MapTypeCodeToType(counterTypeCode)), VBFriendlyName(loopFor._widestType)))
                         Else
                             Dim widestType As Type = GetWidestType(MapTypeCodeToType(counterTypeCode), loopFor._widestType)
                             Dim widestTypeCode As TypeCode = GetTypeCode(widestType)
@@ -365,7 +365,7 @@ NotEnumType:
                         End If
 
                     Catch ex As InvalidCastException
-                        Throw New ArgumentException(GetResourceString(SR.Argument_IComparable2, "loop control variable", VBFriendlyName(loopFor._counter)))
+                        Throw New ArgumentException(SR.Format(SR.Argument_IComparable2, "loop control variable", VBFriendlyName(loopFor._counter)))
                     End Try
                 Else
                     If loopFor._positiveStep Then
index 2eaf92a..55edb72 100644 (file)
@@ -3522,7 +3522,7 @@ DecimalExit:
 
             End Select
 
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(obj), VBFriendlyName(TypeFromTypeCode(toType))))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(obj), VBFriendlyName(TypeFromTypeCode(toType))))
 
         End Function
 
@@ -3572,7 +3572,7 @@ DecimalExit:
                     If (ObjString IsNot Nothing) AndAlso (toType Is GetType(Char())) Then
                         Return CharArrayType.FromString(ObjString)
                     Else
-                        Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(fromType), VBFriendlyName(toType)))
+                        Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(fromType), VBFriendlyName(toType)))
                     End If
                 End If
             Else
@@ -3588,7 +3588,7 @@ CheckForEnumAndExit:
         End Function
 
         Private Shared Function GetNoValidOperatorException(ByVal Operand As Object) As Exception
-            Return New InvalidCastException(GetResourceString(SR.NoValidOperator_OneOperand, VBFriendlyName(Operand)))
+            Return New InvalidCastException(SR.Format(SR.NoValidOperator_OneOperand, VBFriendlyName(Operand)))
         End Function
 
         Private Shared Function GetNoValidOperatorException(ByVal Left As Object, ByVal Right As Object) As Exception
@@ -3604,9 +3604,9 @@ CheckForEnumAndExit:
 
                 If LeftString IsNot Nothing Then
                     Substitution1 =
-                        GetResourceString(SR.NoValidOperator_StringType1, Strings.Left(LeftString, MAX_INSERTION_SIZE))
+                        SR.Format(SR.NoValidOperator_StringType1, Strings.Left(LeftString, MAX_INSERTION_SIZE))
                 Else
-                    Substitution1 = GetResourceString(SR.NoValidOperator_NonStringType1, VBFriendlyName(Left))
+                    Substitution1 = SR.Format(SR.NoValidOperator_NonStringType1, VBFriendlyName(Left))
                 End If
             End If
 
@@ -3617,13 +3617,13 @@ CheckForEnumAndExit:
 
                 If RightString IsNot Nothing Then
                     Substitution2 =
-                        GetResourceString(SR.NoValidOperator_StringType1, Strings.Left(RightString, MAX_INSERTION_SIZE))
+                        SR.Format(SR.NoValidOperator_StringType1, Strings.Left(RightString, MAX_INSERTION_SIZE))
                 Else
-                    Substitution2 = GetResourceString(SR.NoValidOperator_NonStringType1, VBFriendlyName(Right))
+                    Substitution2 = SR.Format(SR.NoValidOperator_NonStringType1, VBFriendlyName(Right))
                 End If
             End If
 
-            Return New InvalidCastException(GetResourceString(SR.NoValidOperator_TwoOperands, Substitution1, Substitution2))
+            Return New InvalidCastException(SR.Format(SR.NoValidOperator_TwoOperands, Substitution1, Substitution2))
         End Function
 
         '**
index b8c1bde..0756c19 100644 (file)
@@ -212,7 +212,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                             errorMessage &= vbCrLf & "    " & errorString
                         Next
 
-                        errorMessage = GetResourceString(SR.MatchArgumentFailure2, operatorMethod.ToString, errorMessage)
+                        errorMessage = SR.Format(SR.MatchArgumentFailure2, operatorMethod.ToString, errorMessage)
                         'We are missing a member which can match the arguments, so throw a missing member exception.
                         Throw New InvalidCastException(errorMessage)
                     End If
index 3bd4b2f..f0f0826 100644 (file)
@@ -88,7 +88,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         End Function
 
         Private Shared Function GetNoValidOperatorException(ByVal op As UserDefinedOperator, ByVal operand As Object) As Exception
-            Return New InvalidCastException(GetResourceString(SR.UnaryOperand2, OperatorNames(op), VBFriendlyName(operand)))
+            Return New InvalidCastException(SR.Format(SR.UnaryOperand2, OperatorNames(op), VBFriendlyName(operand)))
         End Function
 
         Private Shared Function GetNoValidOperatorException(ByVal op As UserDefinedOperator, ByVal left As Object, ByVal right As Object) As Exception
@@ -104,9 +104,9 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 If leftString IsNot Nothing Then
                     substitution1 =
-                        GetResourceString(SR.NoValidOperator_StringType1, Strings.Left(leftString, maxInsertionSize))
+                        SR.Format(SR.NoValidOperator_StringType1, Strings.Left(leftString, maxInsertionSize))
                 Else
-                    substitution1 = GetResourceString(SR.NoValidOperator_NonStringType1, VBFriendlyName(left))
+                    substitution1 = SR.Format(SR.NoValidOperator_NonStringType1, VBFriendlyName(left))
                 End If
             End If
 
@@ -117,13 +117,13 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
                 If rightString IsNot Nothing Then
                     substitution2 =
-                        GetResourceString(SR.NoValidOperator_StringType1, Strings.Left(rightString, maxInsertionSize))
+                        SR.Format(SR.NoValidOperator_StringType1, Strings.Left(rightString, maxInsertionSize))
                 Else
-                    substitution2 = GetResourceString(SR.NoValidOperator_NonStringType1, VBFriendlyName(right))
+                    substitution2 = SR.Format(SR.NoValidOperator_NonStringType1, VBFriendlyName(right))
                 End If
             End If
 
-            Return New InvalidCastException(GetResourceString(SR.BinaryOperands3, OperatorNames(op), substitution1, substitution2))
+            Return New InvalidCastException(SR.Format(SR.BinaryOperands3, OperatorNames(op), substitution1, substitution2))
         End Function
 
 #Region " Comparison Operators = <> < <= > >= "
index be2b0e3..8f56a82 100644 (file)
@@ -2441,7 +2441,7 @@ skipargument:
 
             Debug.Assert(errors IsNot Nothing, "expected error table")
             errors.Add(
-                GetResourceString(
+                SR.Format(
                     resourceID,
                     substitution1,
                     VBFriendlyName(substitution2),
@@ -2456,7 +2456,7 @@ skipargument:
 
             Debug.Assert(errors IsNot Nothing, "expected error table")
             errors.Add(
-                GetResourceString(
+                SR.Format(
                     resourceID,
                     substitution1,
                     substitution2.ToString))
@@ -2469,7 +2469,7 @@ skipargument:
 
             Debug.Assert(errors IsNot Nothing, "expected error table")
             errors.Add(
-                GetResourceString(
+                SR.Format(
                     resourceID,
                     substitution1))
         End Sub
@@ -2477,8 +2477,7 @@ skipargument:
         Private Shared Sub ReportError(ByVal errors As List(Of String), ByVal resourceID As String)
 
             Debug.Assert(errors IsNot Nothing, "expected error table")
-            errors.Add(
-                GetResourceString(resourceID))
+            errors.Add(resourceID)
         End Sub
 
         Private Delegate Function ArgumentDetector(
@@ -2545,7 +2544,7 @@ skipargument:
 
             Debug.Assert(candidateReportCount > 0, "expected at least one candidate")
 
-            Dim message As String = GetResourceString(errorID, overloadedProcedureName, errorMessage.ToString)
+            Dim message As String = SR.Format(errorID, overloadedProcedureName, errorMessage.ToString)
             If candidateReportCount = 1 Then
                 'ParamArrays may cause only one candidate to get reported. In this case, reporting an
                 'ambiguity is misleading.
@@ -2823,7 +2822,7 @@ skipargument:
                     ElseIf rejectedForTypeArgumentCount > 0 Then
                         errorID = SR.NoTypeArgumentCountOverloadCandidates1
                     End If
-                    Throw New MissingMemberException(GetResourceString(errorID, methodName))
+                    Throw New MissingMemberException(SR.Format(errorID, methodName))
                 End If
                 Return Nothing
             End If
index ffdb225..2cf1909 100644 (file)
@@ -98,7 +98,7 @@ Namespace Global.Microsoft.VisualBasic.CompilerServices
             If assem Is Utils.VBRuntimeAssembly OrElse assem Is m_CachedMSCoreLibAssembly Then
                 'Must have been from a latebound call to our own apis (potentially through context of mscorlib)
                 'This must not be allowed, as it would cause files to be shared across assemblies
-                Throw New Security.SecurityException(GetResourceString(SR.Security_LateBoundCallsNotPermitted))
+                Throw New Security.SecurityException(SR.Security_LateBoundCallsNotPermitted)
             End If
 
             Dim AssemData As AssemblyData = CType(m_AssemblyData.Item(assem), AssemblyData)
index 3c2aaea..b7ee982 100644 (file)
@@ -31,7 +31,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Return CShort(DoubleType.Parse(Value))
 
             Catch e As FormatException
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Short"), e)
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Short"), e)
             End Try
 
         End Function
@@ -114,7 +114,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     ' Fall through to error
             End Select
 ThrowInvalidCast:
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Short"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Short"))
 
         End Function
 
index aaa26e0..05d2a4e 100644 (file)
@@ -40,7 +40,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 Return CSng(Result)
 
             Catch e As FormatException
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Single"), e)
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Single"), e)
             End Try
 
         End Function
@@ -129,7 +129,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             End Select
 
 ThrowInvalidCast:
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Single"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "Single"))
         End Function
 
         Private Shared Function DecimalToSingle(ByVal ValueInterface As IConvertible) As Single
index dfec9d9..3873c95 100644 (file)
@@ -157,7 +157,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 End If
             End If
 
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(Value), "String"))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(Value), "String"))
 
         End Function
 
@@ -372,7 +372,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If SourceEndIndex = 0 Then
                     Return False
                 Else
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Pattern"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Pattern"))
                 End If
             Else
                 Return (PatternIndex = PatternEndIndex) AndAlso (SourceIndex = SourceEndIndex)
@@ -583,7 +583,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If SourceEndIndex = 0 Then
                     Return False
                 Else
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Pattern"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Pattern"))
                 End If
             Else
                 Return (PatternIndex = PatternEndIndex) AndAlso (SourceIndex = SourceEndIndex)
@@ -777,11 +777,11 @@ Namespace Microsoft.VisualBasic.CompilerServices
             StartPosition -= 1
 
             If StartPosition < 0 OrElse StartPosition >= DestLength Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Start"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start"))
             End If
 
             If MaxInsertLength < 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Length"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Length"))
             End If
 
             '  first, limit the length of the source string
index 5bf73e6..272fde1 100644 (file)
@@ -1055,7 +1055,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     If result.Length = 0 Then
                         If reportErrors Then
                             Throw New MissingMemberException(
-                                GetResourceString(SR.MissingMember_NoDefaultMemberFound1, Me.VBFriendlyName))
+                                SR.Format(SR.MissingMember_NoDefaultMemberFound1, Me.VBFriendlyName))
                         End If
 
                         Return result
@@ -1067,7 +1067,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     If result.Length = 0 Then
                         If reportErrors Then
                             Throw New MissingMemberException(
-                                GetResourceString(SR.MissingMember_MemberNotFoundOnType2, memberName, Me.VBFriendlyName))
+                                SR.Format(SR.MissingMember_MemberNotFoundOnType2, memberName, Me.VBFriendlyName))
                         End If
 
                         Return result
@@ -1081,7 +1081,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If _instance Is Nothing AndAlso Not IsShared(field) Then
                     'Reference to non-shared member '|1' requires an object reference.
                     Throw New NullReferenceException(
-                        GetResourceString(SR.NullReference_InstanceReqToAccessMember1, FieldToString(field)))
+                        SR.Format(SR.NullReference_InstanceReqToAccessMember1, FieldToString(field)))
                 End If
                 '
                 'BEGIN: SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY
@@ -1099,13 +1099,13 @@ Namespace Microsoft.VisualBasic.CompilerServices
             Friend Sub SetFieldValue(ByVal field As FieldInfo, ByVal value As Object)
                 If field.IsInitOnly Then
                     Throw New MissingMemberException(
-                        GetResourceString(SR.MissingMember_ReadOnlyField2, field.Name, Me.VBFriendlyName))
+                        SR.Format(SR.MissingMember_ReadOnlyField2, field.Name, Me.VBFriendlyName))
                 End If
 
                 If _instance Is Nothing AndAlso Not IsShared(field) Then
                     'Reference to non-shared member '|1' requires an object reference.
                     Throw New NullReferenceException(
-                        GetResourceString(SR.NullReference_InstanceReqToAccessMember1, FieldToString(field)))
+                        SR.Format(SR.NullReference_InstanceReqToAccessMember1, FieldToString(field)))
                 End If
                 '
                 'BEGIN: SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY
@@ -1244,7 +1244,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 If _instance Is Nothing AndAlso Not IsShared(callTarget) Then
                     'Reference to non-shared member '|1' requires an object reference.
                     Throw New NullReferenceException(
-                        GetResourceString(SR.NullReference_InstanceReqToAccessMember1, targetProcedure.ToString))
+                        SR.Format(SR.NullReference_InstanceReqToAccessMember1, targetProcedure.ToString))
                 End If
                 '
                 'BEGIN: SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY
index ccd16fc..802ba2d 100644 (file)
@@ -44,29 +44,92 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
         Friend Const OptionCompareTextFlags As CompareOptions = (CompareOptions.IgnoreCase Or CompareOptions.IgnoreWidth Or CompareOptions.IgnoreKanaType)
 
+        Private Const ResourceMsgDefault As String = "Message text unavailable.  Resource file 'Microsoft.VisualBasic resources' not found."
+        Private Const VBDefaultErrorID As String = "ID95"
         Friend Shared m_achIntlSpace() As Char = {chSpace, chIntlSpace}
         Private Shared ReadOnly s_voidType As Type = System.Type.GetType("System.Void")
         Private Shared s_VBRuntimeAssembly As System.Reflection.Assembly
 
-        '*****************************************************************************
-        ';GetResourceString
-        '
-        'Summary: Retrieves a resource string and formats it by replacing placeholders
-        '         with params. For example if the unformatted string is
-        '         "Hello, {0}" then GetString("StringID", "World") will return "Hello, World"
-        '         This one is exposed because I have to be able to get at localized error
-        '         strings from the MY template
-        '  Param: ID - Identifier for the string to be retrieved
-        '  Param: Args - An array of params used to replace placeholders.
-        'Returns: The resource string if found or an error message string
-        '*****************************************************************************
+        Private Shared Function GetFallbackMessage(ByVal name As String, ByVal ParamArray args() As Object) As String
+            'last-ditch effort; just give back name
+            Return name
+        End Function
+
         Friend Shared Function GetResourceString(ByVal ResourceId As vbErrors) As String
-            Dim id as String = "ID" & CStr(ResourceId)
+            Dim id As String = "ID" & CStr(ResourceId)
             Return SR.GetResourceString(id, id)
         End Function
 
-        Friend Shared Function GetResourceString(ByVal resourceKey As String, ByVal ParamArray args() As String) As String
-            Return SR.Format(resourceKey, args)
+        <System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
+        Friend Shared Function GetResourceString(ByVal ResourceKey As String) As String
+
+            Dim s As String = Nothing
+
+            Try
+                s = SR.GetResourceString(ResourceKey)
+                ' this may be unknown error, so try getting default message
+                If s Is Nothing Then
+                    s = SR.GetResourceString(VBDefaultErrorID)
+                End If
+
+                'if we have found nothing, get a fallback message.
+                If s Is Nothing Then
+                    s = GetFallbackMessage(ResourceKey)
+                End If
+            Catch ex As StackOverflowException
+                Throw ex
+            Catch ex As OutOfMemoryException
+                Throw ex
+            Catch ex As System.Threading.ThreadAbortException
+                Throw ex
+            Catch
+                s = ResourceMsgDefault
+            End Try
+
+            Return s
+        End Function
+
+        ''' <summary>
+        ''' Retrieves a resource string and formats it by replacing placeholders with parameters.
+        ''' </summary>
+        ''' <param name="ResourceKey">The resource string identifier</param>
+        ''' <param name="Args">An array of parameters used to replace placeholders</param>
+        ''' <returns>The resource string if found or an error message string</returns>
+        Public Shared Function GetResourceString(ByVal ResourceKey As String, ByVal ParamArray Args() As String) As String
+
+            System.Diagnostics.Debug.Assert(Not ResourceKey = "", "ResourceKey is missing")
+            System.Diagnostics.Debug.Assert(Not Args Is Nothing, "No Args")
+
+            Dim UnformattedString As String = Nothing
+            Dim FormattedString As String = Nothing
+            Try
+                'Get unformatted string which may have place holders ie "Hello, {0}. How is {1}?"
+                UnformattedString = GetResourceString(ResourceKey)
+
+                'Replace placeholders with items from the passed in array
+                FormattedString = String.Format(System.Threading.Thread.CurrentThread.CurrentCulture, UnformattedString, Args)
+
+                'Rethrow hosting exceptions
+            Catch ex As StackOverflowException
+                Throw ex
+            Catch ex As OutOfMemoryException
+                Throw ex
+            Catch ex As System.Threading.ThreadAbortException
+                Throw ex
+
+            Catch ex As Exception
+                System.Diagnostics.Debug.Fail("Unable to get and format string for ResourceKey: " & ResourceKey)
+            Finally
+                System.Diagnostics.Debug.Assert(Not UnformattedString = "", "Unable to get string for ResourceKey: " & ResourceKey)
+                System.Diagnostics.Debug.Assert(Not FormattedString = "", "Unable to format string for ResourceKey: " & ResourceKey)
+            End Try
+
+            'Return the string if we have one otherwise return a default error message
+            If Not FormattedString = "" Then
+                Return FormattedString
+            Else
+                Return UnformattedString 'will contain an error string from the attempt to load via the GetResourceString() overload we call internally
+            End If
         End Function
 
         Friend Shared Function StdFormat(ByVal s As String) As String
index 8b4e69e..99ba743 100644 (file)
@@ -33,9 +33,9 @@ Namespace Global.Microsoft.VisualBasic.CompilerServices
 
             If UnsafeNativeMethods.SetLocalTime(systime) = 0 Then
                 If Marshal.GetLastWin32Error() = ERROR_INVALID_PARAMETER Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                    Throw New ArgumentException(SR.Argument_InvalidValue)
                 Else
-                    Throw New SecurityException(GetResourceString(SR.SetLocalTimeFailure))
+                    Throw New SecurityException(SR.SetLocalTimeFailure)
                 End If
             End If
 #Else
@@ -56,9 +56,9 @@ Namespace Global.Microsoft.VisualBasic.CompilerServices
 
             If UnsafeNativeMethods.SetLocalTime(systime) = 0 Then
                 If Marshal.GetLastWin32Error() = ERROR_INVALID_PARAMETER Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                    Throw New ArgumentException(SR.Argument_InvalidValue)
                 Else
-                    Throw New SecurityException(GetResourceString(SR.SetLocalDateFailure))
+                    Throw New SecurityException(SR.SetLocalDateFailure)
                 End If
             End If
 #Else
index 1d52d44..54a72b0 100644 (file)
@@ -27,7 +27,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         ' the implementation of Lock in base class VB6RandomFile does not handle m_lRecordLen=-1
         Friend Overloads Overrides Sub Lock(ByVal lStart As Long, ByVal lEnd As Long)
             If lStart > lEnd Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Start"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start"))
             End If
 
             Dim absRecordLength As Long
@@ -50,7 +50,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         ' see Lock description
         Friend Overloads Overrides Sub Unlock(ByVal lStart As Long, ByVal lEnd As Long)
             If lStart > lEnd Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Start"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start"))
             End If
 
             Dim absRecordLength As Long
@@ -186,7 +186,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             ' reading from a file that was write-only. The inner exception was added to provide more context.
             If (m_access <> OpenAccess.ReadWrite) AndAlso (m_access <> OpenAccess.Read) Then
                 Dim JustNeedTheMessage As New NullReferenceException ' We don't have access to the localized resources for this string.
-                Throw New NullReferenceException(JustNeedTheMessage.Message, New IO.IOException(GetResourceString(SR.FileOpenedNoRead)))
+                Throw New NullReferenceException(JustNeedTheMessage.Message, New IO.IOException(SR.FileOpenedNoRead))
             End If
 
             ' read past any leading spaces or tabs
index a0c3102..3be2f84 100644 (file)
@@ -106,7 +106,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             Dim FieldType As System.Type = field_info.FieldType
 
             If FieldType Is Nothing Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "Empty")), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "Empty")), vbErrors.IllegalFuncCall)
             End If
 
             If FieldType.IsArray() Then
@@ -193,16 +193,16 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     Case TypeCode.Char
                         m_oFile.PutChar(0, CharType.FromObject(vValue))
                     Case TypeCode.DBNull
-                        Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "DBNull")), vbErrors.IllegalFuncCall)
+                        Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "DBNull")), vbErrors.IllegalFuncCall)
                     Case Else 'Case TypeCode.Object
                         If FieldType Is GetType(Object) Then
                             m_oFile.PutObject(vValue, 0)
                         ElseIf FieldType Is GetType(System.Exception) Then
-                            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "Exception")), vbErrors.IllegalFuncCall)
+                            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "Exception")), vbErrors.IllegalFuncCall)
                         ElseIf FieldType Is GetType(System.Reflection.Missing) Then
-                            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "Missing")), vbErrors.IllegalFuncCall)
+                            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "Missing")), vbErrors.IllegalFuncCall)
                         Else
-                            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, FieldType.Name)), vbErrors.IllegalFuncCall)
+                            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, FieldType.Name)), vbErrors.IllegalFuncCall)
                         End If
                 End Select
             End If
@@ -227,7 +227,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             FieldType = field_info.FieldType
 
             If FieldType Is Nothing Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "Empty")), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "Empty")), vbErrors.IllegalFuncCall)
             End If
 
             If FieldType.IsArray() Then
@@ -293,17 +293,17 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     Case TypeCode.Char
                         vValue = m_oFile.GetChar(0)
                     Case TypeCode.DBNull
-                        Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "DBNull")), vbErrors.IllegalFuncCall)
+                        Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "DBNull")), vbErrors.IllegalFuncCall)
                     Case Else
                         'Case TypeCode.Object
                         If FieldType Is GetType(Object) Then
                             m_oFile.GetObject(vValue)
                         ElseIf FieldType Is GetType(System.Exception) Then
-                            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "Exception")), vbErrors.IllegalFuncCall)
+                            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "Exception")), vbErrors.IllegalFuncCall)
                         ElseIf FieldType Is GetType(System.Reflection.Missing) Then
-                            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, "Missing")), vbErrors.IllegalFuncCall)
+                            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, "Missing")), vbErrors.IllegalFuncCall)
                         Else
-                            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedFieldType2, field_info.Name, FieldType.Name)), vbErrors.IllegalFuncCall)
+                            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedFieldType2, field_info.Name, FieldType.Name)), vbErrors.IllegalFuncCall)
                         End If
                 End Select
             End If
@@ -368,7 +368,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             If access <> OpenAccess.Read AndAlso
                access <> OpenAccess.ReadWrite AndAlso
                access <> OpenAccess.Write Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Access"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Access"))
             End If
             m_access = access
 
@@ -376,7 +376,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 share <> OpenShare.LockRead AndAlso
                 share <> OpenShare.LockReadWrite AndAlso
                 share <> OpenShare.LockWrite) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Share"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Share"))
             End If
 
             m_share = share
@@ -946,7 +946,7 @@ NewLine:
             ElseIf cDims = 2 Then
                 SecondBound = arr.GetUpperBound(1)
             ElseIf cDims <> 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_UnsupportedArrayDimensions))
+                Throw New ArgumentException(SR.Argument_UnsupportedArrayDimensions)
             End If
 
             SetRecord(RecordNumber)
@@ -1662,7 +1662,7 @@ NewLine:
                 ArrUBoundY = -1
                 ArrUBoundX = -1
             ElseIf (arr.GetUpperBound(0) > FirstBound) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_ArrayDimensionsDontMatch))
+                Throw New ArgumentException(SR.Argument_ArrayDimensionsDontMatch)
             End If
 
             If typ Is Nothing Then
@@ -1682,7 +1682,7 @@ NewLine:
                 iUpperElementY = FirstBound
                 If Not arr Is Nothing Then
                     If arr.Rank <> 2 OrElse arr.GetUpperBound(1) <> SecondBound Then
-                        Throw New ArgumentException(GetResourceString(SR.Argument_ArrayDimensionsDontMatch))
+                        Throw New ArgumentException(SR.Argument_ArrayDimensionsDontMatch)
                     End If
                     ArrUBoundY = arr.GetUpperBound(0)
                     ArrUBoundX = arr.GetUpperBound(1)
@@ -1702,7 +1702,7 @@ NewLine:
                     End If
                 End If
                 If FixedStringLength = 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidFixedLengthString))
+                    Throw New ArgumentException(SR.Argument_InvalidFixedLengthString)
                 ElseIf FixedStringLength > 0 Then
                     FixedBlankString = StrDup(FixedStringLength, " "c)
                     FixedCharArray = FixedBlankString.ToCharArray() 'Used for padding
@@ -1849,7 +1849,7 @@ NewLine:
 
                             If ByteLength > System.Int16.MaxValue Then
                                 'Size for strings is 2 bytes, thus the Short.MaxValue limitation
-                                Throw VbMakeException(New ArgumentException(GetResourceString(SR.FileIO_StringLengthExceeded)), vbErrors.IllegalFuncCall)
+                                Throw VbMakeException(New ArgumentException(SR.FileIO_StringLengthExceeded), vbErrors.IllegalFuncCall)
                             End If
 
                             'Do a length check and write out the length if not fixed length
@@ -1913,7 +1913,7 @@ NewLine:
             Dim iUpperElementY As Integer
 
             If arr Is Nothing Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_ArrayNotInitialized))
+                Throw New ArgumentException(SR.Argument_ArrayNotInitialized)
             End If
 
             If typ Is Nothing Then
@@ -2031,7 +2031,7 @@ NewLine:
                             arr.SetValue(obj, iElementY, iElementX)
                         End If
                     Catch Ex As IndexOutOfRangeException
-                        Throw New ArgumentException(GetResourceString(SR.Argument_ArrayDimensionsDontMatch))
+                        Throw New ArgumentException(SR.Argument_ArrayDimensionsDontMatch)
                     End Try
                 Next iElementY
             Next iElementX
@@ -2172,7 +2172,7 @@ NewLine:
                             ElseIf typ Is GetType(System.Reflection.Missing) Then
                                 s = "Error 448"
                             Else
-                                Throw New ArgumentException(GetResourceString(SR.Argument_UnsupportedIOType1, VBFriendlyName(typ)))
+                                Throw New ArgumentException(SR.Format(SR.Argument_UnsupportedIOType1, VBFriendlyName(typ)))
                             End If
                     End Select
                 End If
@@ -2671,7 +2671,7 @@ SkipWhiteSpaceExit:
         Private Sub ValidateReadable()
             If (m_access <> OpenAccess.ReadWrite) AndAlso (m_access <> OpenAccess.Read) Then
                 Dim JustNeedTheMessage As New NullReferenceException ' We don't have access to the localized resources for this string.
-                Throw New NullReferenceException(JustNeedTheMessage.Message, New IO.IOException(GetResourceString(SR.FileOpenedNoRead)))
+                Throw New NullReferenceException(JustNeedTheMessage.Message, New IO.IOException(SR.FileOpenedNoRead))
             End If
         End Sub
 
index 7b63a6d..8eef9d8 100644 (file)
@@ -129,7 +129,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
         Friend Overloads Overrides Sub Lock(ByVal lStart As Long, ByVal lEnd As Long)
             If lStart > lEnd Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Start"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start"))
             End If
 
             Dim lStartByte As Long
@@ -143,7 +143,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
         Friend Overloads Overrides Sub Unlock(ByVal lStart As Long, ByVal lEnd As Long)
             If lStart > lEnd Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Start"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start"))
             End If
 
             Dim lStartByte As Long
@@ -275,13 +275,13 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 ElseIf vtype = VT.DBNull AndAlso ContainedInVariant Then
                     Value = DBNull.Value
                 ElseIf vtype = VT.DBNull Then
-                    Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedIOType1, "DBNull")), vbErrors.IllegalFuncCall)
+                    Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedIOType1, "DBNull")), vbErrors.IllegalFuncCall)
                 ElseIf vtype = VT.Empty Then
                     Value = Nothing
                 ElseIf vtype = VT.Currency Then
-                    Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedIOType1, "Currency")), vbErrors.IllegalFuncCall)
+                    Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedIOType1, "Currency")), vbErrors.IllegalFuncCall)
                 Else
-                    Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedIOType1, typ.FullName)), vbErrors.IllegalFuncCall)
+                    Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedIOType1, typ.FullName)), vbErrors.IllegalFuncCall)
                 End If
             End If
         End Sub
@@ -297,7 +297,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             ValidateReadable()
 
             If (Value Is Nothing) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_ArrayNotInitialized))
+                Throw New ArgumentException(SR.Argument_ArrayNotInitialized)
             End If
 
             Dim typ As Type = Value.GetType().GetElementType
@@ -319,7 +319,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 ElseIf cDims = 2 Then
                     obj = Value.GetValue(0, 0)
                 Else '0 or > 2
-                    Throw New ArgumentException(GetResourceString(SR.Argument_UnsupportedArrayDimensions))
+                    Throw New ArgumentException(SR.Argument_UnsupportedArrayDimensions)
                 End If
 
                 If obj Is Nothing Then
@@ -329,7 +329,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                 End If
 
                 If len = 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidFixedLengthString))
+                    Throw New ArgumentException(SR.Argument_InvalidFixedLengthString)
                 End If
             End If
 
@@ -345,7 +345,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             ElseIf cDims = 2 Then
                 SecondBound = Value.GetUpperBound(1)
             Else '0 or > 2
-                Throw New ArgumentException(GetResourceString(SR.Argument_UnsupportedArrayDimensions))
+                Throw New ArgumentException(SR.Argument_UnsupportedArrayDimensions)
             End If
 
             If ArrayIsDynamic Then
@@ -440,7 +440,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
             typ = Value.GetType
 
             If typ Is Nothing Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedIOType1, "Empty")), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedIOType1, "Empty")), vbErrors.IllegalFuncCall)
             ElseIf typ.IsArray Then
                 PutDynamicArray(RecordNumber, CType(Value, System.Array))
                 Exit Sub
@@ -489,16 +489,16 @@ Namespace Microsoft.VisualBasic.CompilerServices
             End Select
 
             If typ Is GetType(System.Reflection.Missing) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedIOType1, "Missing")), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedIOType1, "Missing")), vbErrors.IllegalFuncCall)
 
             ElseIf typ.IsValueType() AndAlso Not ContainedInVariant Then
                 PutRecord(RecordNumber, CType(Value, ValueType))
 
             ElseIf ContainedInVariant AndAlso typ.IsValueType Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_PutObjectOfValueType1, VBFriendlyName(typ, Value))), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_PutObjectOfValueType1, VBFriendlyName(typ, Value))), vbErrors.IllegalFuncCall)
 
             Else
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_UnsupportedIOType1, VBFriendlyName(typ, Value))), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_UnsupportedIOType1, VBFriendlyName(typ, Value))), vbErrors.IllegalFuncCall)
             End If
         End Sub
 
@@ -600,13 +600,13 @@ Namespace Microsoft.VisualBasic.CompilerServices
 
         Protected Sub ValidateWriteable()
             If (m_access <> OpenAccess.ReadWrite) AndAlso (m_access <> OpenAccess.Write) Then
-                Throw VbMakeExceptionEx(vbErrors.PathFileAccess, GetResourceString(SR.FileOpenedNoWrite))
+                Throw VbMakeExceptionEx(vbErrors.PathFileAccess, SR.FileOpenedNoWrite)
             End If
         End Sub
 
         Protected Sub ValidateReadable()
             If (m_access <> OpenAccess.ReadWrite) AndAlso (m_access <> OpenAccess.Read) Then
-                Throw VbMakeExceptionEx(vbErrors.PathFileAccess, GetResourceString(SR.FileOpenedNoRead))
+                Throw VbMakeExceptionEx(vbErrors.PathFileAccess, SR.FileOpenedNoRead)
             End If
         End Sub
 
index 079861b..ef5b839 100644 (file)
@@ -47,7 +47,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
         Private m_CachedMember As MemberInfo
 
         Private Sub ThrowInvalidCast(ByVal ArgType As System.Type, ByVal ParmType As System.Type, ByVal ParmIndex As Integer)
-            Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromToArg4, CalledMethodName(), CStr(ParmIndex + 1), VBFriendlyName(ArgType), VBFriendlyName(ParmType)))
+            Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromToArg4, CalledMethodName(), CStr(ParmIndex + 1), VBFriendlyName(ArgType), VBFriendlyName(ParmType)))
         End Sub
 
         'Flags to indicate if parameter was passed
@@ -301,7 +301,7 @@ CleanupAndExit:
 
                                 If StrComp(names(NameIndex), Parameters(ParmIndex).Name, CompareMethod.Text) = 0 Then
                                     If ParmIndex = ParamArrayIndex AndAlso SelectedCount = 1 Then
-                                        Throw VbMakeExceptionEx(vbErrors.NamedArgsNotSupported, GetResourceString(SR.NamedArgumentOnParamArray))
+                                        Throw VbMakeExceptionEx(vbErrors.NamedArgsNotSupported, SR.NamedArgumentOnParamArray)
                                     Else
                                         If ParmIndex = ParamArrayIndex Then
                                             'Matched against a paramarray, force into the removal code below
@@ -323,7 +323,7 @@ CleanupAndExit:
                                     '   i.e.  MissingMethod, MissingField, MissingMember
                                     'This is the last possible matching member
                                     ' so throw an exception that the name doesn't match
-                                    Throw New MissingMemberException(GetResourceString(SR.Argument_InvalidNamedArg2, names(NameIndex), CalledMethodName()))
+                                    Throw New MissingMemberException(SR.Format(SR.Argument_InvalidNamedArg2, names(NameIndex), CalledMethodName()))
                                 End If
 
                                 match(MethodIndex) = Nothing
@@ -392,7 +392,7 @@ CleanupAndExit:
                     If (ParamArrayIndex = PARAMARRAY_NONE) AndAlso (args.Length > Parameters.Length) Then
                         'If we have too many arguments, we don't match any function
                         If SelectedCount = 1 Then
-                            Throw New MissingMemberException(GetResourceString(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
+                            Throw New MissingMemberException(SR.Format(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
                         End If
 
                         'Clear this entry
@@ -422,7 +422,7 @@ CleanupAndExit:
                         If (j <> LengthOfNonParamArrayArguments) Then
                             'Not enough arguments to call this method, so remove it
                             If SelectedCount = 1 Then
-                                Throw New MissingMemberException(GetResourceString(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
+                                Throw New MissingMemberException(SR.Format(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
                             End If
                             match(MethodIndex) = Nothing
                             SelectedCount -= 1
@@ -568,7 +568,7 @@ CleanupAndExit:
                                 GoTo NextParm7
                             Else
                                 If SelectedCount = 1 Then
-                                    Throw New MissingMemberException(GetResourceString(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
+                                    Throw New MissingMemberException(SR.Format(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
                                 End If
                                 GoTo ClearMethod7
                             End If
@@ -748,7 +748,7 @@ ClearMethod7:
                     If InitialMemberCount = 1 Then
                         ThrowInvalidCast(ArgType, ParmType, ParmIndex)
                     Else
-                        Throw New AmbiguousMatchException(GetResourceString(SR.AmbiguousMatch_NarrowingConversion1, CalledMethodName()))
+                        Throw New AmbiguousMatchException(SR.Format(SR.AmbiguousMatch_NarrowingConversion1, CalledMethodName()))
                     End If
                 End If
                 match(MethodIndex) = Nothing
@@ -912,7 +912,7 @@ NextMethod8:
             Next
 
             If (SelectedCount = 0) Then
-                Throw New MissingMemberException(GetResourceString(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
+                Throw New MissingMemberException(SR.Format(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
             End If
 
             state = New VBBinderState
@@ -1084,15 +1084,15 @@ NextMethod8:
 
                     Select Case LowestScore
                         Case BindScore.Exact
-                            Throw New AmbiguousMatchException(GetResourceString(SR.AmbiguousCall_ExactMatch2, CalledMethodName(), Msg))
+                            Throw New AmbiguousMatchException(SR.Format(SR.AmbiguousCall_ExactMatch2, CalledMethodName(), Msg))
 
                         Case BindScore.Widening0, BindScore.Widening1
-                            Throw New AmbiguousMatchException(GetResourceString(SR.AmbiguousCall_WideningConversion2, CalledMethodName(), Msg))
+                            Throw New AmbiguousMatchException(SR.Format(SR.AmbiguousCall_WideningConversion2, CalledMethodName(), Msg))
 
                         Case Else
                             'BindScore.Narrowing
                             'BindScore.Unknown
-                            Throw New AmbiguousMatchException(GetResourceString(SR.AmbiguousCall2, CalledMethodName(), Msg))
+                            Throw New AmbiguousMatchException(SR.Format(SR.AmbiguousCall2, CalledMethodName(), Msg))
                     End Select
                 End If
 
@@ -1239,7 +1239,7 @@ NextMethod8:
             '
             Debug.Assert(Not SelectedMatch Is Nothing, "Should have already thrown an exception")
             If SelectedMatch Is Nothing Then
-                Throw New MissingMemberException(GetResourceString(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
+                Throw New MissingMemberException(SR.Format(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, IsPropertySet))))
             End If
             Return SelectedMatch
 
@@ -1762,7 +1762,7 @@ NextMethod8:
                     Return ObjectType.CTypeHelper(value, typ)
                 End If
             Catch ex As Exception
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(value), VBFriendlyName(typ)))
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(value), VBFriendlyName(typ)))
             End Try
         End Function
 
@@ -1905,7 +1905,7 @@ NextMethod8:
                     If StrComp(names(i), pars(j).Name, CompareMethod.Text) = 0 Then
 
                         If paramOrder(j) <> -1 Then
-                            Return New ArgumentException(GetResourceString(SR.NamedArgumentAlreadyUsed1, pars(j).Name))
+                            Return New ArgumentException(SR.Format(SR.NamedArgumentAlreadyUsed1, pars(j).Name))
                         End If
 
                         paramOrder(j) = i
@@ -1920,7 +1920,7 @@ NextMethod8:
                 ' method must not match what we sent.
                 If (j > LastNonSetIndex) Then
                     'Should no longer hit this, since we removed all these cases in a previous step
-                    Return New MissingMemberException(GetResourceString(SR.Argument_InvalidNamedArg2, names(i), CalledMethodName()))
+                    Return New MissingMemberException(SR.Format(SR.Argument_InvalidNamedArg2, names(i), CalledMethodName()))
                 End If
 
             Next i
@@ -1952,7 +1952,7 @@ NextMethod8:
                     'END: SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY SECURITY
                     '
                 Catch ex As MissingMemberException
-                    Throw New MissingMemberException(GetResourceString(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType)))
+                    Throw New MissingMemberException(SR.Format(SR.MissingMember_MemberNotFoundOnType2, name, VBFriendlyName(objType)))
                 End Try
             End If
 
@@ -1979,7 +1979,7 @@ NextMethod8:
                 If (objType Is objIReflect) Then
                     name = GetDefaultMemberName(objType)
                     If (name Is Nothing) Then
-                        Throw New MissingMemberException(GetResourceString(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType)))
+                        Throw New MissingMemberException(SR.Format(SR.MissingMember_NoDefaultMemberFound1, VBFriendlyName(objType)))
                     End If
                 Else
                     ' IReflect case, we pass in empty string so that user implementation can return default members determined at run time
@@ -1998,7 +1998,7 @@ NextMethod8:
             Dim binderState As Object = Nothing
             invokeMethod = Me.BindToMethod(invokeAttr, p, args, Nothing, Nothing, namedParameters, binderState)
             If (invokeMethod Is Nothing) Then
-                Throw New MissingMemberException(GetResourceString(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, (invokeAttr And BindingFlags.SetProperty) <> 0))))
+                Throw New MissingMemberException(SR.Format(SR.NoMethodTakingXArguments2, CalledMethodName(), CStr(GetPropArgCount(args, (invokeAttr And BindingFlags.SetProperty) <> 0))))
             End If
 
             '
@@ -2212,7 +2212,7 @@ NextMethod8:
                     Next j
 
                     If RemovedCount = mi.Length - 1 Then
-                        Throw New ArgumentException(GetResourceString(SR.Argument_IllegalNestedType2, name, VBFriendlyName(objType)))
+                        Throw New ArgumentException(SR.Format(SR.Argument_IllegalNestedType2, name, VBFriendlyName(objType)))
                     End If
                     mi(MemberIndex) = Nothing 'Remove the nested class, since we cannot use it
                     RemovedCount += 1
index ce48f6a..10530da 100644 (file)
@@ -38,7 +38,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                     Return Nothing
 
                 Case Else
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "CallType"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "CallType"))
             End Select
 
         End Function
index a4759e2..201be08 100644 (file)
@@ -58,7 +58,7 @@ Namespace Microsoft.VisualBasic
 
         Public Function ErrorToString(ByVal ErrorNumber As Integer) As String
             If ErrorNumber >= MAX_ERR_NUMBER Then
-                Throw New ArgumentException(GetResourceString(SR.MaxErrNumber))
+                Throw New ArgumentException(SR.MaxErrNumber)
             End If
 
             If ErrorNumber > 0 Then
@@ -117,7 +117,7 @@ Namespace Microsoft.VisualBasic
 
         Public Function Fix(ByVal Number As Object) As Object
             If Number Is Nothing Then
-                Throw New ArgumentNullException(GetResourceString(SR.Argument_InvalidNullValue1, "Number"))
+                Throw New ArgumentNullException(SR.Format(SR.Argument_InvalidNullValue1, "Number"))
             End If
 
             Dim ValueInterface As IConvertible
@@ -163,7 +163,7 @@ Namespace Microsoft.VisualBasic
 
             End If
 
-            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_NotNumericType2, NameOf(Number), Number.GetType().FullName)), vbErrors.TypeMismatch)
+            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_NotNumericType2, NameOf(Number), Number.GetType().FullName)), vbErrors.TypeMismatch)
         End Function
 
         Public Function Int(ByVal Number As Short) As Short
@@ -192,7 +192,7 @@ Namespace Microsoft.VisualBasic
 
         Public Function Int(ByVal Number As Object) As Object
             If Number Is Nothing Then
-                Throw New ArgumentNullException(GetResourceString(SR.Argument_InvalidNullValue1, NameOf(Number)))
+                Throw New ArgumentNullException(SR.Format(SR.Argument_InvalidNullValue1, NameOf(Number)))
             End If
 
             Dim ValueInterface As IConvertible
@@ -236,7 +236,7 @@ Namespace Microsoft.VisualBasic
                 End Select
             End If
 
-            Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_NotNumericType2, NameOf(Number), Number.GetType().FullName)), vbErrors.TypeMismatch)
+            Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_NotNumericType2, NameOf(Number), Number.GetType().FullName)), vbErrors.TypeMismatch)
         End Function
 
         '============================================================================
@@ -282,7 +282,7 @@ Namespace Microsoft.VisualBasic
             Dim LongValue As Long
 
             If Number Is Nothing Then
-                Throw New ArgumentNullException(GetResourceString(SR.Argument_InvalidNullValue1, NameOf(Number)))
+                Throw New ArgumentNullException(SR.Format(SR.Argument_InvalidNullValue1, NameOf(Number)))
             End If
 
             Dim ValueInterface As IConvertible
@@ -355,7 +355,7 @@ RangeCheck:
                 End Select
             End If
 
-            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValueType2, NameOf(Number), VBFriendlyName(Number)))
+            Throw New ArgumentException(SR.Format(SR.Argument_InvalidValueType2, NameOf(Number), VBFriendlyName(Number)))
         End Function
 
         <CLSCompliant(False)>
@@ -398,7 +398,7 @@ RangeCheck:
             Dim LongValue As Long
 
             If Number Is Nothing Then
-                Throw New ArgumentNullException(GetResourceString(SR.Argument_InvalidNullValue1, NameOf(Number)))
+                Throw New ArgumentNullException(SR.Format(SR.Argument_InvalidNullValue1, NameOf(Number)))
             End If
 
             Dim ValueInterface As IConvertible
@@ -466,14 +466,14 @@ RangeCheck:
                 End Select
             End If
 
-            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValueType2, NameOf(Number), VBFriendlyName(Number)))
+            Throw New ArgumentException(SR.Format(SR.Argument_InvalidValueType2, NameOf(Number), VBFriendlyName(Number)))
         End Function
 
         Public Function Str(ByVal Number As Object) As String
             Dim s As String
 
             If Number Is Nothing Then
-                Throw New ArgumentNullException(GetResourceString(SR.Argument_InvalidNullValue1, NameOf(Number)))
+                Throw New ArgumentNullException(SR.Format(SR.Argument_InvalidNullValue1, NameOf(Number)))
             End If
 
             Dim ValueInterface As IConvertible
@@ -482,7 +482,7 @@ RangeCheck:
             ValueInterface = TryCast(Number, IConvertible)
 
             If ValueInterface Is Nothing Then
-                Throw New InvalidCastException(GetResourceString(SR.ArgumentNotNumeric1, NameOf(Number)))
+                Throw New InvalidCastException(SR.Format(SR.ArgumentNotNumeric1, NameOf(Number)))
             End If
 
             ValueTypeCode = ValueInterface.GetTypeCode()
@@ -526,7 +526,7 @@ RangeCheck:
                             'Throw our own exception below
                         End Try
                     End If
-                    Throw New InvalidCastException(GetResourceString(SR.ArgumentNotNumeric1, NameOf(Number)))
+                    Throw New InvalidCastException(SR.Format(SR.ArgumentNotNumeric1, NameOf(Number)))
             End Select
 
 FormatAndExit:
@@ -922,7 +922,7 @@ NextOctCharacter:
                 Catch ex As System.Threading.ThreadAbortException
                     Throw ex
                 Catch
-                    Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValueType2, NameOf(Expression), VBFriendlyName(Expression))), vbErrors.OLENoPropOrMethod)
+                    Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValueType2, NameOf(Expression), VBFriendlyName(Expression))), vbErrors.OLENoPropOrMethod)
                 End Try
 
                 Return Val(sValue)
index bc42c49..c5da896 100644 (file)
@@ -62,7 +62,7 @@ Namespace Microsoft.VisualBasic
                 Catch ex As System.Threading.ThreadAbortException
                     Throw ex
                 Catch
-                    Throw VbMakeException(New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Date")), vbErrors.IllegalFuncCall)
+                    Throw VbMakeException(New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Date")), vbErrors.IllegalFuncCall)
                 End Try
 
                 SetTime(dt)
@@ -113,7 +113,7 @@ Namespace Microsoft.VisualBasic
                 Catch ex As System.Threading.ThreadAbortException
                     Throw ex
                 Catch
-                    Throw VbMakeException(New InvalidCastException(GetResourceString(SR.InvalidCast_FromStringTo, Left(Value, 32), "Date")), vbErrors.IllegalFuncCall)
+                    Throw VbMakeException(New InvalidCastException(SR.Format(SR.InvalidCast_FromStringTo, Left(Value, 32), "Date")), vbErrors.IllegalFuncCall)
                 End Try
 
                 SetDate(NewDate)
@@ -166,7 +166,7 @@ Namespace Microsoft.VisualBasic
                     Return DateValue.AddMonths(lNumber * 3)
             End Select
 
-            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Interval"))
+            Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Interval"))
         End Function
 
         Public Function DateDiff(ByVal Interval As DateInterval,
@@ -208,7 +208,7 @@ Namespace Microsoft.VisualBasic
                     Return (cal.GetYear(Date2) - cal.GetYear(Date1)) * 4 + (cal.GetMonth(Date2) - 1) \ 3 - (cal.GetMonth(Date1) - 1) \ 3
             End Select
 
-            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Interval"))
+            Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Interval"))
         End Function
 
         Private Function GetDayOfWeek(ByVal dt As Date, ByVal weekdayFirst As FirstDayOfWeek) As Integer
@@ -272,7 +272,7 @@ Namespace Microsoft.VisualBasic
                     Return CurrentCalendar.GetDayOfYear(DateValue)
             End Select
 
-            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Interval"))
+            Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Interval"))
         End Function
 
         Public Function DateAdd(ByVal Interval As String,
@@ -290,7 +290,7 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw New InvalidCastException(GetResourceString(SR.Argument_InvalidDateValue1, "DateValue"))
+                Throw New InvalidCastException(SR.Format(SR.Argument_InvalidDateValue1, "DateValue"))
             End Try
 
             Return DateAdd(DateIntervalFromString(Interval), Number, dt1)
@@ -313,7 +313,7 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw New InvalidCastException(GetResourceString(SR.Argument_InvalidDateValue1, "Date1"))
+                Throw New InvalidCastException(SR.Format(SR.Argument_InvalidDateValue1, "Date1"))
             End Try
             Try
                 dt2 = CDate(Date2)
@@ -324,7 +324,7 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw New InvalidCastException(GetResourceString(SR.Argument_InvalidDateValue1, "Date2"))
+                Throw New InvalidCastException(SR.Format(SR.Argument_InvalidDateValue1, "Date2"))
             End Try
 
             Return DateDiff(DateIntervalFromString(Interval), dt1, dt2, DayOfWeek, WeekOfYear)
@@ -345,7 +345,7 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw New InvalidCastException(GetResourceString(SR.Argument_InvalidDateValue1, "DateValue"))
+                Throw New InvalidCastException(SR.Format(SR.Argument_InvalidDateValue1, "DateValue"))
             End Try
 
             Return DatePart(DateIntervalFromString(Interval), dt1, DayOfWeek, WeekOfYear)
@@ -378,7 +378,7 @@ Namespace Microsoft.VisualBasic
                 Case "Q"
                     Return DateInterval.Quarter
                 Case Else
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Interval"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Interval"))
             End Select
         End Function
 
@@ -420,7 +420,7 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Year")), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Year")), vbErrors.IllegalFuncCall)
             End Try
 
             Try
@@ -432,7 +432,7 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Month")), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Month")), vbErrors.IllegalFuncCall)
             End Try
 
             Try
@@ -444,7 +444,7 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Day")), vbErrors.IllegalFuncCall)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Day")), vbErrors.IllegalFuncCall)
             End Try
 
             Return Result
@@ -508,7 +508,7 @@ Namespace Microsoft.VisualBasic
                 DayOfWeek = CType(DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek + 1, FirstDayOfWeek)
 
             ElseIf (DayOfWeek < FirstDayOfWeek.Sunday) OrElse (DayOfWeek > FirstDayOfWeek.Saturday) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "DayOfWeek"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "DayOfWeek"))
             End If
 
             'Get the day from the date
@@ -526,7 +526,7 @@ Namespace Microsoft.VisualBasic
             Dim Result As String
 
             If Month < 1 OrElse Month > 13 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Month"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Month"))
             End If
 
             If Abbreviate Then
@@ -536,7 +536,7 @@ Namespace Microsoft.VisualBasic
             End If
 
             If Result.Length = 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Month"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Month"))
             End If
 
             Return Result
@@ -547,11 +547,11 @@ Namespace Microsoft.VisualBasic
             Dim Result As String
 
             If (Weekday < 1) OrElse (Weekday > 7) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Weekday"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Weekday"))
             End If
 
             If (FirstDayOfWeekValue < 0) OrElse (FirstDayOfWeekValue > 7) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "FirstDayOfWeekValue"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "FirstDayOfWeekValue"))
             End If
 
             dtfi = CType(GetCultureInfo().GetFormat(GetType(System.Globalization.DateTimeFormatInfo)), DateTimeFormatInfo)  'Returns a read-only object
@@ -573,11 +573,11 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Weekday"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Weekday"))
             End Try
 
             If Result.Length = 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Weekday"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Weekday"))
             End If
 
             Return Result
index 346c655..5fca012 100644 (file)
@@ -111,9 +111,9 @@ Namespace Microsoft.VisualBasic
             Dim tmpNumber As Integer = Me.Number
 
             If Msg Is Nothing OrElse Msg.Length = 0 Then
-                Msg = GetResourceString("ID" & CStr(tmpNumber))
+                Msg = SR.GetResourceString("ID" & CStr(tmpNumber))
             ElseIf System.String.CompareOrdinal("Exception from HRESULT: 0x", 0, Msg, 0, Math.Min(Msg.Length, 26)) = 0 Then
-                NewMsg = GetResourceString("ID" & CStr(m_curNumber))
+                NewMsg = SR.GetResourceString("ID" & CStr(m_curNumber))
                 If Not NewMsg Is Nothing Then
                     Msg = NewMsg
                 End If
@@ -279,7 +279,7 @@ Namespace Microsoft.VisualBasic
 
             If Number = 0 Then
                 'This is only called by Raise, so Raise(0) should give the following exception
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Number"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Number"))
             End If
             Me.Number = Number
 
@@ -342,7 +342,7 @@ Namespace Microsoft.VisualBasic
 
             If Number = 0 Then
                 'This is only called by Error xxxx, zero is not a valid exception number
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Number"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Number"))
             End If
 
             Dim e As Exception = MapNumberToException(m_curNumber, Description)
@@ -433,7 +433,7 @@ Namespace Microsoft.VisualBasic
         Friend Function MapErrorNumber(ByVal Number As Integer) As Integer
             If Number > 65535 Then
                 ' Number cannot be greater than 65535.
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1), "Number")
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1), "Number")
             End If
 
             If Number >= 0 Then
index daed471..0ac0869 100644 (file)
@@ -993,7 +993,7 @@ Namespace Microsoft.VisualBasic.FileIO
 
             ' Throw the final exception if there were exceptions during copy / move.
             If Exceptions.Count > 0 Then
-                Dim IOException As New IO.IOException(Utils.GetResourceString(SR.IO_CopyMoveRecursive))
+                Dim IOException As New IO.IOException(SR.IO_CopyMoveRecursive)
                 For Each Entry As DictionaryEntry In Exceptions
                     IOException.Data.Add(Entry.Key, Entry.Value)
                 Next
index 2efdab0..0b69cda 100644 (file)
@@ -123,7 +123,7 @@ Namespace Microsoft.VisualBasic.FileIO
         ''' <returns>The base ToString plus the Line Number</returns>
         ''' <remarks></remarks>
         Public Overrides Function ToString() As String
-            Return MyBase.ToString() & " " & GetResourceString(SR.TextFieldParser_MalformedExtraData, LineNumber.ToString(CultureInfo.InvariantCulture))
+            Return MyBase.ToString() & " " & SR.Format(SR.TextFieldParser_MalformedExtraData, LineNumber.ToString(CultureInfo.InvariantCulture))
         End Function
 
         ' Holds the line number
index 47f214d..f0bcac6 100644 (file)
@@ -152,7 +152,7 @@ Namespace Microsoft.VisualBasic.FileIO
         Private Shared Function GetDirectoryPath(ByVal Directory As String, ByVal DirectoryNameResID As String) As String
             ' Only need to worry about Directory being "" since it comes from Framework.
             If Directory = "" Then
-                Throw ExUtils.GetDirectoryNotFoundException(SR.IO_SpecialDirectoryNotExist, GetResourceString(DirectoryNameResID))
+                Throw ExUtils.GetDirectoryNotFoundException(SR.IO_SpecialDirectoryNotExist, DirectoryNameResID)
             End If
             Return FileSystem.NormalizePath(Directory)
         End Function
index 5e67cd9..96e9558 100644 (file)
@@ -599,7 +599,7 @@ Namespace Microsoft.VisualBasic.FileIO
 
             ' Make sure the file exists
             If Not File.Exists(fullPath) Then
-                Throw New IO.FileNotFoundException(GetResourceString(SR.IO_FileNotFound_Path, fullPath))
+                Throw New IO.FileNotFoundException(SR.Format(SR.IO_FileNotFound_Path, fullPath))
             End If
 
             Return fullPath
@@ -914,7 +914,7 @@ Namespace Microsoft.VisualBasic.FileIO
                     If EndHelper.MalformedLine Then
                         m_ErrorLine = Line.TrimEnd(Chr(13), Chr(10))
                         m_ErrorLineNumber = CurrentLineNumber
-                        Throw New MalformedLineException(GetResourceString(SR.TextFieldParser_MalFormedDelimitedLine, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
+                        Throw New MalformedLineException(SR.Format(SR.TextFieldParser_MalFormedDelimitedLine, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
                     End If
 
                     If EndHelper.FieldFinished Then
@@ -934,13 +934,13 @@ Namespace Microsoft.VisualBasic.FileIO
                             If NewLine Is Nothing Then
                                 m_ErrorLine = Line.TrimEnd(Chr(13), Chr(10))
                                 m_ErrorLineNumber = CurrentLineNumber
-                                Throw New MalformedLineException(GetResourceString(SR.TextFieldParser_MalFormedDelimitedLine, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
+                                Throw New MalformedLineException(SR.Format(SR.TextFieldParser_MalFormedDelimitedLine, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
                             End If
 
                             If Line.Length + NewLine.Length > m_MaxLineSize Then
                                 m_ErrorLine = Line.TrimEnd(Chr(13), Chr(10))
                                 m_ErrorLineNumber = CurrentLineNumber
-                                Throw New MalformedLineException(GetResourceString(SR.TextFieldParser_MaxLineSizeExceeded, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
+                                Throw New MalformedLineException(SR.Format(SR.TextFieldParser_MaxLineSizeExceeded, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
                             End If
 
                             Line &= NewLine
@@ -949,7 +949,7 @@ Namespace Microsoft.VisualBasic.FileIO
                             If EndHelper.MalformedLine Then
                                 m_ErrorLine = Line.TrimEnd(Chr(13), Chr(10))
                                 m_ErrorLineNumber = CurrentLineNumber
-                                Throw New MalformedLineException(GetResourceString(SR.TextFieldParser_MalFormedDelimitedLine, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
+                                Throw New MalformedLineException(SR.Format(SR.TextFieldParser_MalFormedDelimitedLine, CurrentLineNumber.ToString(CultureInfo.InvariantCulture)), CurrentLineNumber)
                             End If
                         Loop Until EndHelper.FieldFinished
 
@@ -1099,7 +1099,7 @@ Namespace Microsoft.VisualBasic.FileIO
             If Line.LengthInTextElements < m_LineLength Then
                 m_ErrorLine = Line.String
                 m_ErrorLineNumber = m_LineNumber - 1
-                Throw New MalformedLineException(GetResourceString(SR.TextFieldParser_MalFormedFixedWidthLine, LineNumber.ToString(CultureInfo.InvariantCulture)), LineNumber)
+                Throw New MalformedLineException(SR.Format(SR.TextFieldParser_MalFormedFixedWidthLine, LineNumber.ToString(CultureInfo.InvariantCulture)), LineNumber)
             End If
 
         End Sub
index f83474f..51c07ed 100644 (file)
@@ -58,7 +58,7 @@ Namespace Microsoft.VisualBasic
             Path = RTrim(Path) 'VB6 accepted things like "\   ", so need to trim the trailing spaces
 
             If (Path Is Nothing) OrElse (Path.Length = 0) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_PathNullOrEmpty)), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Argument_PathNullOrEmpty), vbErrors.BadFileNameOrNumber)
             End If
 
             ' Do this since System.IO.Directory does not accept "\"
@@ -69,7 +69,7 @@ Namespace Microsoft.VisualBasic
             Try
                 System.IO.Directory.SetCurrentDirectory(Path)
             Catch ex As System.IO.FileNotFoundException
-                Throw VbMakeException(New FileNotFoundException(GetResourceString(SR.FileSystem_PathNotFound1, Path)), vbErrors.PathNotFound)
+                Throw VbMakeException(New FileNotFoundException(SR.Format(SR.FileSystem_PathNotFound1, Path)), vbErrors.PathNotFound)
             End Try
 
         End Sub
@@ -78,11 +78,11 @@ Namespace Microsoft.VisualBasic
             Drive = System.Char.ToUpper(Drive, CultureInfo.InvariantCulture)
 
             If (Drive < chLetterA) OrElse (Drive > chLetterZ) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Drive"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Drive"))
             End If
 
             If Not UnsafeValidDrive(Drive) Then
-                Throw VbMakeException(New IOException(GetResourceString(SR.FileSystem_DriveNotFound1, CStr(Drive))), vbErrors.DevUnavailable)
+                Throw VbMakeException(New IOException(SR.Format(SR.FileSystem_DriveNotFound1, CStr(Drive))), vbErrors.DevUnavailable)
             End If
 
             IO.Directory.SetCurrentDirectory(Drive & Path.VolumeSeparatorChar)
@@ -112,14 +112,14 @@ Namespace Microsoft.VisualBasic
 
             Drive = System.Char.ToUpper(Drive, CultureInfo.InvariantCulture)
             If (Drive < chLetterA OrElse Drive > chLetterZ) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Drive")), vbErrors.DevUnavailable)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Drive")), vbErrors.DevUnavailable)
             End If
 
             'GetFullPath("x:.") will return the full directory path
             Dim CurrentPath As String = Path.GetFullPath(Drive & Path.VolumeSeparatorChar & ".")
 
             If Not UnsafeValidDrive(Drive) Then
-                Throw VbMakeException(New IOException(GetResourceString(SR.FileSystem_DriveNotFound1, CStr(Drive))), vbErrors.DevUnavailable)
+                Throw VbMakeException(New IOException(SR.Format(SR.FileSystem_DriveNotFound1, CStr(Drive))), vbErrors.DevUnavailable)
             End If
             Return CurrentPath
         End Function
@@ -195,7 +195,7 @@ Namespace Microsoft.VisualBasic
                 "Methods in Microsoft.VisualBasic should not call FileSystem public method.")
 
             If Path Is Nothing OrElse Path.Length = 0 Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_PathNullOrEmpty)), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Argument_PathNullOrEmpty), vbErrors.BadFileNameOrNumber)
             End If
 
             If Directory.Exists(Path) Then
@@ -211,7 +211,7 @@ Namespace Microsoft.VisualBasic
 
             'If null or empty directory, give error
             If Path Is Nothing OrElse Path.Length = 0 Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_PathNullOrEmpty)), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Argument_PathNullOrEmpty), vbErrors.BadFileNameOrNumber)
             End If
 
             Try
@@ -251,30 +251,30 @@ Namespace Microsoft.VisualBasic
 
         Public Sub FileCopy(ByVal Source As String, ByVal Destination As String)
             If (Source Is Nothing) OrElse (Source.Length = 0) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_PathNullOrEmpty1, "Source")), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_PathNullOrEmpty1, "Source")), vbErrors.BadFileNameOrNumber)
             End If
 
             If (Destination Is Nothing) OrElse (Destination.Length = 0) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_PathNullOrEmpty1, "Destination")), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_PathNullOrEmpty1, "Destination")), vbErrors.BadFileNameOrNumber)
             End If
 
             '  Error if wildcard characters in name
             If PathContainsWildcards(Source) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Source")), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Source")), vbErrors.BadFileNameOrNumber)
             End If
 
             If PathContainsWildcards(Destination) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Destination")), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Destination")), vbErrors.BadFileNameOrNumber)
             End If
 
             Dim oAssemblyData As AssemblyData = ProjectData.GetProjectData().GetAssemblyData(System.Reflection.Assembly.GetCallingAssembly())
 
             If CheckFileOpen(oAssemblyData, Destination, OpenModeTypes.Output) Then
-                Throw VbMakeException(New IOException(GetResourceString(SR.FileSystem_FileAlreadyOpen1, Destination)), vbErrors.FileAlreadyOpen)
+                Throw VbMakeException(New IOException(SR.Format(SR.FileSystem_FileAlreadyOpen1, Destination)), vbErrors.FileAlreadyOpen)
             End If
 
             If CheckFileOpen(oAssemblyData, Source, OpenModeTypes.Input) Then
-                Throw VbMakeException(New IOException(GetResourceString(SR.FileSystem_FileAlreadyOpen1, Source)), vbErrors.FileAlreadyOpen)
+                Throw VbMakeException(New IOException(SR.Format(SR.FileSystem_FileAlreadyOpen1, Source)), vbErrors.FileAlreadyOpen)
             End If
 
             Try
@@ -298,14 +298,14 @@ Namespace Microsoft.VisualBasic
                 "Methods in Microsoft.VisualBasic should not call FileSystem public method.")
 
             If PathContainsWildcards(PathName) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "PathName")), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "PathName")), vbErrors.BadFileNameOrNumber)
             End If
 
             If File.Exists(PathName) Then
                 Return (New FileInfo(PathName)).LastWriteTime
             End If
 
-            Throw New FileNotFoundException(GetResourceString(SR.FileSystem_FileNotFound1, PathName))
+            Throw New FileNotFoundException(SR.Format(SR.FileSystem_FileNotFound1, PathName))
         End Function
 
         Public Function FileLen(ByVal PathName As String) As Long
@@ -316,7 +316,7 @@ Namespace Microsoft.VisualBasic
                 Return (New FileInfo(PathName)).Length
             End If
 
-            Throw New FileNotFoundException(GetResourceString(SR.FileSystem_FileNotFound1, PathName))
+            Throw New FileNotFoundException(SR.Format(SR.FileSystem_FileNotFound1, PathName))
         End Function
 
         Public Function GetAttr(ByVal PathName As String) As FileAttribute
@@ -363,7 +363,7 @@ Namespace Microsoft.VisualBasic
             If Path.GetFileName(PathName).Length = 0 Then
                 Throw VbMakeException(vbErrors.BadFileNameOrNumber)
             Else
-                Throw New FileNotFoundException(GetResourceString(SR.FileSystem_FileNotFound1, PathName))
+                Throw New FileNotFoundException(SR.Format(SR.FileSystem_FileNotFound1, PathName))
             End If
 
         End Function
@@ -404,7 +404,7 @@ Namespace Microsoft.VisualBasic
                         '  error if file is presently open
                         Dim oAssemblyData As AssemblyData = ProjectData.GetProjectData().GetAssemblyData(System.Reflection.Assembly.GetCallingAssembly())
                         If CheckFileOpen(oAssemblyData, FileName, OpenModeTypes.Any) Then
-                            Throw VbMakeException(New IOException(GetResourceString(SR.FileSystem_FileAlreadyOpen1, FileName)), vbErrors.FileAlreadyOpen)
+                            Throw VbMakeException(New IOException(SR.Format(SR.FileSystem_FileAlreadyOpen1, FileName)), vbErrors.FileAlreadyOpen)
                         End If
 
                         Try
@@ -424,7 +424,7 @@ Namespace Microsoft.VisualBasic
             End If
 
             If DeleteCount = 0 Then
-                Throw New IO.FileNotFoundException(GetResourceString(SR.KILL_NoFilesFound1, PathName))
+                Throw New IO.FileNotFoundException(SR.Format(SR.KILL_NoFilesFound1, PathName))
             End If
         End Sub
 
@@ -449,7 +449,7 @@ Namespace Microsoft.VisualBasic
 
             'Check pathname for errors and if file is open for any mode except sequential input
             If (PathName Is Nothing) OrElse (PathName.Length = 0) Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_PathNullOrEmpty)), vbErrors.BadFileNameOrNumber)
+                Throw VbMakeException(New ArgumentException(SR.Argument_PathNullOrEmpty), vbErrors.BadFileNameOrNumber)
             End If
 
             Dim assem As System.Reflection.Assembly = System.Reflection.Assembly.GetCallingAssembly()
@@ -459,7 +459,7 @@ Namespace Microsoft.VisualBasic
 
             'Only allow _A_RDONLY(1), _A_HIDDEN(2), _A_SYSTEM(4), _A_ARCH(20)
             If ((Attributes Or &H27S) <> &H27S) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Attributes"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Attributes"))
             End If
 
             'Dir function always returns files with Normal attribute in addition to others specified.
@@ -485,7 +485,7 @@ Namespace Microsoft.VisualBasic
                 Access <> OpenAccess.Read AndAlso
                 Access <> OpenAccess.ReadWrite AndAlso
                 Access <> OpenAccess.Write Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Access"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Access"))
             End If
         End Sub
 
@@ -495,7 +495,7 @@ Namespace Microsoft.VisualBasic
                 Share <> OpenShare.LockRead AndAlso
                 Share <> OpenShare.LockReadWrite AndAlso
                 Share <> OpenShare.LockWrite Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Share"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Share"))
             End If
         End Sub
 
@@ -505,7 +505,7 @@ Namespace Microsoft.VisualBasic
                 Mode <> OpenMode.Random AndAlso
                 Mode <> OpenMode.Append AndAlso
                 Mode <> OpenMode.Binary Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Mode"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Mode"))
             End If
         End Sub
 
@@ -563,7 +563,7 @@ Namespace Microsoft.VisualBasic
 
         Private Sub ValidateGetPutRecordNumber(ByVal RecordNumber As Long)
             If RecordNumber < 1 AndAlso RecordNumber <> -1 Then
-                Throw VbMakeException(New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "RecordNumber")), vbErrors.BadRecordNum)
+                Throw VbMakeException(New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "RecordNumber")), vbErrors.BadRecordNum)
             End If
         End Sub
 
@@ -720,7 +720,7 @@ Namespace Microsoft.VisualBasic
 
         <ObsoleteAttribute("This member has been deprecated. Please use FilePutObject to write Object types, or coerce FileNumber and RecordNumber to Integer for writing non-Object types. http://go.microsoft.com/fwlink/?linkid=14202")>
         Public Sub FilePut(ByVal FileNumber As Object, ByVal Value As Object, Optional ByVal RecordNumber As Object = -1)
-            Throw New ArgumentException(GetResourceString(SR.UseFilePutObject))
+            Throw New ArgumentException(SR.UseFilePutObject)
         End Sub
 
         Public Sub FilePut(ByVal FileNumber As Integer, ByVal Value As ValueType, Optional ByVal RecordNumber As Long = -1)
@@ -1004,7 +1004,7 @@ Namespace Microsoft.VisualBasic
                 Dim oFile As VB6File
 
                 If (CharCount < 0 OrElse CharCount > (&H7FFFFFFFI / 2)) Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "CharCount"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "CharCount"))
                 End If
 
                 Dim assem As System.Reflection.Assembly = System.Reflection.Assembly.GetCallingAssembly()
@@ -1245,7 +1245,7 @@ Namespace Microsoft.VisualBasic
 
             ' This exception should never be hit.
             ' We will throw Arguments are not valid.
-            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue), "om")
+            Throw New ArgumentException(SR.Argument_InvalidValue, "om")
         End Function
 
         Friend Sub CloseAllFiles(ByVal assem As System.Reflection.Assembly)
@@ -1284,7 +1284,7 @@ Namespace Microsoft.VisualBasic
             Dim Result As String
             '  Error if wildcard characters in pathname
             If (sPath.IndexOf("?"c) <> -1 OrElse sPath.IndexOf("*"c) <> -1) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidPathChars1, sPath))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidPathChars1, sPath))
             End If
 
             '  process the name to check for errors
@@ -1408,12 +1408,12 @@ Namespace Microsoft.VisualBasic
 
                 Case OpenMode.Input
                     If (Access <> OpenAccess.Read) AndAlso (Access <> OpenAccess.Default) Then
-                        Throw New ArgumentException(GetResourceString(SR.FileSystem_IllegalInputAccess))
+                        Throw New ArgumentException(SR.FileSystem_IllegalInputAccess)
                     End If
                     oFile = New VB6InputFile(FileName, Share)
                 Case OpenMode.Output
                     If (Access <> OpenAccess.Write) AndAlso (Access <> OpenAccess.Default) Then
-                        Throw New ArgumentException(GetResourceString(SR.FileSystem_IllegalOutputAccess))
+                        Throw New ArgumentException(SR.FileSystem_IllegalOutputAccess)
                     End If
                     oFile = New VB6OutputFile(FileName, Share, False)
                 Case OpenMode.Random
@@ -1423,7 +1423,7 @@ Namespace Microsoft.VisualBasic
                     oFile = New VB6RandomFile(FileName, Access, Share, RecordLength)
                 Case OpenMode.Append
                     If (Access <> OpenAccess.Write) AndAlso (Access <> OpenAccess.ReadWrite) AndAlso (Access <> OpenAccess.Default) Then
-                        Throw New ArgumentException(GetResourceString(SR.FileSystem_IllegalAppendAccess))
+                        Throw New ArgumentException(SR.FileSystem_IllegalAppendAccess)
                     End If
                     oFile = New VB6OutputFile(FileName, Share, True)
                 Case OpenMode.Binary
index 960ee86..b099de6 100644 (file)
@@ -58,7 +58,7 @@ Namespace Microsoft.VisualBasic
 
             '   Handle invalid parameters
             If Factor <= 0.0# OrElse Salvage < 0.0# OrElse Period <= 0.0# OrElse Period > Life Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Factor"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Factor"))
             End If
 
             '   Handle special (trivial) cases
@@ -190,7 +190,7 @@ Namespace Microsoft.VisualBasic
 
             '   Type = 0 or non-zero only. Offset to calculate FV
             If (Per <= 0.0#) OrElse (Per >= NPer + 1) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Per"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Per"))
             End If
 
             If (Due <> DueDate.EndOfPeriod) AndAlso (Per = 1.0#) Then
@@ -260,18 +260,18 @@ Namespace Microsoft.VisualBasic
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "ValueArray"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "ValueArray"))
             End Try
 
             lCVal = lUpper + 1
 
             'Function fails for invalid parameters
             If Guess <= (-1.0#) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Guess"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Guess"))
             End If
 
             If lCVal <= 1 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "ValueArray"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "ValueArray"))
             End If
 
             'We scale the epsilon depending on cash flow values. It is necessary
@@ -305,7 +305,7 @@ Namespace Microsoft.VisualBasic
             End If
 
             If dRate1 <= (-1.0#) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Rate"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Rate"))
             End If
 
             dNpv1 = OptPV2(ValueArray, dRate1)
@@ -319,7 +319,7 @@ Namespace Microsoft.VisualBasic
                     End If
                     dNPv0 = OptPV2(ValueArray, dRate0)
                     If dNpv1 = dNPv0 Then
-                        Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                        Throw New ArgumentException(SR.Argument_InvalidValue)
                     End If
                 End If
 
@@ -359,7 +359,7 @@ Namespace Microsoft.VisualBasic
                 dRate1 = dTemp
             Next lIndex
 
-            Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+            Throw New ArgumentException(SR.Argument_InvalidValue)
         End Function
 
         '-------------------------------------------------------------
@@ -381,7 +381,7 @@ Namespace Microsoft.VisualBasic
             Dim lUpper As Integer
 
             If ValueArray.Rank <> 1 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_RankEQOne1, "ValueArray"))
+                Throw New ArgumentException(SR.Format(SR.Argument_RankEQOne1, "ValueArray"))
             End If
 
             lLower = 0
@@ -389,20 +389,20 @@ Namespace Microsoft.VisualBasic
             lCVal = lUpper - lLower + 1
 
             If FinanceRate = -1.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "FinanceRate"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "FinanceRate"))
             End If
 
             If ReinvestRate = -1.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "ReinvestRate"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "ReinvestRate"))
             End If
 
             If lCVal <= 1 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "ValueArray"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "ValueArray"))
             End If
 
             dNpvNeg = LDoNPV(FinanceRate, ValueArray, -1)
             If dNpvNeg = 0.0# Then
-                Throw New DivideByZeroException(GetResourceString(SR.Financial_CalcDivByZero))
+                Throw New DivideByZeroException(SR.Financial_CalcDivByZero)
             End If
 
             dNpvPos = LDoNPV(ReinvestRate, ValueArray, 1) ' npv of +ve values
@@ -412,7 +412,7 @@ Namespace Microsoft.VisualBasic
             dTemp = -dNpvPos * dTemp1 ^ dNTemp2 / (dNpvNeg * (FinanceRate + 1.0#))
 
             If dTemp < 0.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                Throw New ArgumentException(SR.Argument_InvalidValue)
             End If
 
             dTemp1 = 1 / (lCVal - 1.0#)
@@ -447,12 +447,12 @@ Namespace Microsoft.VisualBasic
 
             '   Checking Error Conditions
             If Rate <= -1.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Rate"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Rate"))
             End If
 
             If Rate = 0.0# Then
                 If Pmt = 0.0# Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Pmt"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Pmt"))
                 End If
                 Return (-(PV + FV) / Pmt)
             Else
@@ -469,7 +469,7 @@ Namespace Microsoft.VisualBasic
                     dTempFv = -1 * dTempFv
                     dTempPv = -1 * dTempPv
                 ElseIf dTempFv <= 0.0# OrElse dTempPv <= 0.0# Then
-                    Throw New ArgumentException(GetResourceString(SR.Financial_CannotCalculateNPer))
+                    Throw New ArgumentException(SR.Financial_CannotCalculateNPer)
                 End If
 
                 dTemp4 = Rate + 1.0#
@@ -504,11 +504,11 @@ Namespace Microsoft.VisualBasic
             Dim lUpper As Integer
 
             If (ValueArray Is Nothing) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidNullValue1, "ValueArray"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidNullValue1, "ValueArray"))
             End If
 
             If ValueArray.Rank <> 1 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_RankEQOne1, "ValueArray"))
+                Throw New ArgumentException(SR.Format(SR.Argument_RankEQOne1, "ValueArray"))
             End If
 
             lLower = 0
@@ -516,10 +516,10 @@ Namespace Microsoft.VisualBasic
             lCVal = lUpper - lLower + 1
 
             If Rate = (-1.0#) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Rate"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Rate"))
             End If
             If lCVal < 1 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "ValueArray"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "ValueArray"))
             End If
 
             NPV = LDoNPV(Rate, ValueArray, 0)
@@ -575,7 +575,7 @@ Namespace Microsoft.VisualBasic
 
             '       Checking for error conditions
             If NPer = 0.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "NPer"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "NPer"))
             End If
 
             If Rate = 0.0# Then
@@ -615,7 +615,7 @@ Namespace Microsoft.VisualBasic
 
             '   Checking for error conditions
             If (Per <= 0.0#) OrElse (Per >= (NPer + 1)) Then
-                Throw New ArgumentException(GetResourceString(SR.PPMT_PerGT0AndLTNPer, "Per"))
+                Throw New ArgumentException(SR.Format(SR.PPMT_PerGT0AndLTNPer, "Per"))
             End If
 
             Pmt = PMT_Internal(Rate, NPer, PV, FV, Due)
@@ -703,7 +703,7 @@ Namespace Microsoft.VisualBasic
 
             '   Check for error condition
             If NPer <= 0.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Rate_NPerMustBeGTZero))
+                Throw New ArgumentException(SR.Rate_NPerMustBeGTZero)
             End If
 
             dRate0 = Guess
@@ -725,7 +725,7 @@ Namespace Microsoft.VisualBasic
                     End If
                     dY0 = LEvalRate(dRate0, NPer, Pmt, PV, FV, Due)
                     If dY1 = dY0 Then
-                        Throw New ArgumentException(GetResourceString(SR.Financial_CalcDivByZero))
+                        Throw New ArgumentException(SR.Financial_CalcDivByZero)
                     End If
                 End If
 
@@ -745,7 +745,7 @@ Namespace Microsoft.VisualBasic
                 dRate1 = dTemp
             Next I
 
-            Throw New ArgumentException(GetResourceString(SR.Financial_CannotCalculateRate))
+            Throw New ArgumentException(SR.Financial_CannotCalculateRate)
 
         End Function
 
@@ -765,7 +765,7 @@ Namespace Microsoft.VisualBasic
         Public Function SLN(ByVal Cost As Double, ByVal Salvage As Double, ByVal Life As Double) As Double
 
             If Life = 0.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Financial_LifeNEZero))
+                Throw New ArgumentException(SR.Financial_LifeNEZero)
             End If
 
             Return (Cost - Salvage) / (Life)
@@ -795,13 +795,13 @@ Namespace Microsoft.VisualBasic
             Dim Result As Double
 
             If Salvage < 0.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Financial_ArgGEZero1, "Salvage"))
+                Throw New ArgumentException(SR.Format(SR.Financial_ArgGEZero1, "Salvage"))
             End If
             If Period > Life Then
-                Throw New ArgumentException(GetResourceString(SR.Financial_PeriodLELife))
+                Throw New ArgumentException(SR.Financial_PeriodLELife)
             End If
             If Period <= 0.0# Then
-                Throw New ArgumentException(GetResourceString(SR.Financial_ArgGTZero1, "Period"))
+                Throw New ArgumentException(SR.Format(SR.Financial_ArgGTZero1, "Period"))
             End If
 
             'Avoid OverflowExceptions by dividing before multiplying
index e4dd3f5..bed7d30 100644 (file)
@@ -81,7 +81,7 @@ Namespace Microsoft.VisualBasic
 
             'Validate index - Note that unlike the fx, this is a legacy VB function and the index is 1 based.
             If Expression <= 0 OrElse Expression > 255 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_Range1toFF1, "Expression"))
+                Throw New ArgumentException(SR.Format(SR.Argument_Range1toFF1, "Expression"))
             End If
 
             If m_SortedEnvList Is Nothing Then
@@ -108,7 +108,7 @@ Namespace Microsoft.VisualBasic
             Expression = Trim(Expression)
 
             If Expression.Length = 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Expression"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Expression"))
             End If
 
             Return Environment.GetEnvironmentVariable(Expression)
@@ -151,7 +151,7 @@ Namespace Microsoft.VisualBasic
             Dim FixedIndex As Integer = CInt(Fix(Index) - 1) 'ParamArray is 0 based, but Choose assumes 1 based 
 
             If Choice.Rank <> 1 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_RankEQOne1, "Choice"))
+                Throw New ArgumentException(SR.Format(SR.Argument_RankEQOne1, "Choice"))
             ElseIf FixedIndex < 0 OrElse FixedIndex > Choice.GetUpperBound(0) Then
                 Return Nothing
             End If
@@ -188,15 +188,15 @@ Namespace Microsoft.VisualBasic
 
             'Validate arguments
             If Start < 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Start"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start"))
             End If
 
             If [Stop] <= Start Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Stop"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Stop"))
             End If
 
             If Interval < 1 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Interval"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Interval"))
             End If
 
             'Check for before-first and after-last ranges
@@ -297,7 +297,7 @@ Namespace Microsoft.VisualBasic
 
             'Ensure we have an even number of arguments (0 based)
             If (Elements Mod 2) <> 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "VarExpr"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "VarExpr"))
             End If
 
             Do While Elements > 0
@@ -332,7 +332,7 @@ Namespace Microsoft.VisualBasic
                 Else
                     AppSectionKey = UserKey.OpenSubKey(AppSection, True)
                     If AppSectionKey Is Nothing Then
-                        Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Section"))
+                        Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Section"))
                     End If
 
                     AppSectionKey.DeleteValue(Key)
@@ -442,7 +442,7 @@ Namespace Microsoft.VisualBasic
             ElseIf TypeOf o Is String Then ' - odd that this is required to be a string when it isn't in GetAllSettings() above...
                 Return DirectCast(o, String)
             Else
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue))
+                Throw New ArgumentException(SR.Argument_InvalidValue)
             End If
         End Function
 
@@ -460,7 +460,7 @@ Namespace Microsoft.VisualBasic
 
             If rk Is Nothing Then
                 'Subkey could not be created
-                Throw New ArgumentException(GetResourceString(SR.Interaction_ResKeyNotCreated1, sIniSect))
+                Throw New ArgumentException(SR.Format(SR.Interaction_ResKeyNotCreated1, sIniSect))
             End If
 
             Try
@@ -489,7 +489,7 @@ Namespace Microsoft.VisualBasic
 
         Private Sub CheckPathComponent(ByVal s As String)
             If (s Is Nothing) OrElse (s.Length = 0) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_PathNullOrEmpty))
+                Throw New ArgumentException(SR.Argument_PathNullOrEmpty)
             End If
         End Sub
 
@@ -595,7 +595,7 @@ Namespace Microsoft.VisualBasic
                     Return Nothing
 
                 Case Else
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "CallType"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "CallType"))
             End Select
         End Function
 
index 44f7678..3e60217 100644 (file)
@@ -26,7 +26,7 @@ Namespace Global.Microsoft.VisualBasic
             If service Is GetType(NumberFormatInfo) Then
                 Return nfi
             End If
-            Throw New ArgumentException(GetResourceString(SR.InternalError_VisualBasicRuntime))
+            Throw New ArgumentException(SR.InternalError_VisualBasicRuntime)
         End Function
 
     End Class
@@ -113,7 +113,7 @@ Namespace Global.Microsoft.VisualBasic
                 SyncLock m_SyncObject
                     If Not m_LastUsedYesNoCulture Is ci Then
                         m_LastUsedYesNoCulture = ci
-                        m_CachedYesNoFormatStyle = GetResourceString(SR.YesNoFormatStyle)
+                        m_CachedYesNoFormatStyle = SR.YesNoFormatStyle
                     End If
                     Return m_CachedYesNoFormatStyle
                 End SyncLock
@@ -128,7 +128,7 @@ Namespace Global.Microsoft.VisualBasic
                 SyncLock m_SyncObject
                     If Not m_LastUsedOnOffCulture Is ci Then
                         m_LastUsedOnOffCulture = ci
-                        m_CachedOnOffFormatStyle = GetResourceString(SR.OnOffFormatStyle)
+                        m_CachedOnOffFormatStyle = SR.OnOffFormatStyle
                     End If
                     Return m_CachedOnOffFormatStyle
                 End SyncLock
@@ -143,7 +143,7 @@ Namespace Global.Microsoft.VisualBasic
                 SyncLock m_SyncObject
                     If Not m_LastUsedTrueFalseCulture Is ci Then
                         m_LastUsedTrueFalseCulture = ci
-                        m_CachedTrueFalseFormatStyle = GetResourceString(SR.TrueFalseFormatStyle)
+                        m_CachedTrueFalseFormatStyle = SR.TrueFalseFormatStyle
                     End If
                     Return m_CachedTrueFalseFormatStyle
                 End SyncLock
@@ -492,7 +492,7 @@ EmptyMatchString:
             Catch ex As System.Threading.ThreadAbortException
                 Throw ex
             Catch
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValueType2, "SourceArray", "String"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValueType2, "SourceArray", "String"))
             End Try
 
             Return Join(StringSource, Delimiter)
@@ -506,7 +506,7 @@ EmptyMatchString:
                 End If
 
                 If SourceArray.Rank <> 1 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_RankEQOne1))
+                    Throw New ArgumentException(SR.Format(SR.Argument_RankEQOne1))
                 End If
 
                 Return System.String.Join(Delimiter, SourceArray)
@@ -666,11 +666,11 @@ EmptyMatchString:
             Try
                 'Validate Parameters
                 If Count < -1 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_GEMinusOne1, "Count"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_GEMinusOne1, "Count"))
                 End If
 
                 If Start <= 0 Then
-                    Throw New ArgumentException(GetResourceString("Argument_GTZero1", "Start"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_GTZero1, "Start"))
                 End If
 
                 If (Expression Is Nothing) OrElse (Start > Expression.Length) Then
@@ -766,7 +766,7 @@ EmptyFindString:
                 Return New String(ChrW(32), Number)
             End If
 
-            Throw New ArgumentException(GetResourceString(SR.Argument_GEZero1, "Number"))
+            Throw New ArgumentException(SR.Format(SR.Argument_GEZero1, "Number"))
 
         End Function
 
@@ -953,18 +953,18 @@ RedimAndExit:
             Dim SingleChar As Char
 
             If Number < 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Number"))
+                Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Number"))
             End If
 
             If Character Is Nothing Then
-                Throw New ArgumentNullException(GetResourceString(SR.Argument_InvalidNullValue1, "Character"))
+                Throw New ArgumentNullException(SR.Format(SR.Argument_InvalidNullValue1, "Character"))
             End If
 
             s = TryCast(Character, String)
 
             If s IsNot Nothing Then
                 If s.Length = 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_LengthGTZero1, "Character"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_LengthGTZero1, "Character"))
                 End If
                 SingleChar = s.Chars(0)
             Else
@@ -977,7 +977,7 @@ RedimAndExit:
                 Catch ex As System.Threading.ThreadAbortException
                     Throw ex
                 Catch
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Character"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Character"))
                 End Try
             End If
 
@@ -986,7 +986,7 @@ RedimAndExit:
 
         Public Function StrDup(ByVal Number As Integer, ByVal Character As Char) As String
             If Number < 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_GEZero1, "Number"))
+                Throw New ArgumentException(SR.Format(SR.Argument_GEZero1, "Number"))
             End If
 
             Return New String(Character, Number)
@@ -994,11 +994,11 @@ RedimAndExit:
 
         Public Function StrDup(ByVal Number As Integer, ByVal Character As String) As String
             If Number < 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_GEZero1, "Number"))
+                Throw New ArgumentException(SR.Format(SR.Argument_GEZero1, "Number"))
             End If
 
             If Character Is Nothing OrElse Character.Length = 0 Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_LengthGTZero1, "Character"))
+                Throw New ArgumentException(SR.Format(SR.Argument_LengthGTZero1, "Character"))
             End If
 
             Return New String(Character.Chars(0), Number)
@@ -1280,7 +1280,7 @@ RedimAndExit:
                 If iformat Is Nothing Then
                     tc = System.Convert.GetTypeCode(Expression)
                     If tc <> TypeCode.String AndAlso tc <> TypeCode.Boolean Then
-                        Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Expression"))
+                        Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Expression"))
                     End If
                 End If
 
@@ -1361,7 +1361,7 @@ RedimAndExit:
                 ValidateTriState(GroupDigits)
 
                 If NumDigitsAfterDecimal > 99 Then  'Was 255 in VB6, but System.Globalization.NumberFormatInfo.CurrencyDecimalDigits limits this to 99.
-                    Throw New ArgumentException(GetResourceString(SR.Argument_Range0to99_1, "NumDigitsAfterDecimal"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_Range0to99_1, "NumDigitsAfterDecimal"))
                 End If
 
                 If Expression Is Nothing Then
@@ -1373,7 +1373,7 @@ RedimAndExit:
                 If typ Is GetType(System.String) Then
                     Expression = CDbl(Expression)
                 ElseIf Not Symbols.IsNumericType(typ) Then
-                    Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(typ), "Currency"))
+                    Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(typ), "Currency"))
                 End If
 
                 ifmt = CType(Expression, IFormattable)
@@ -1456,7 +1456,7 @@ RedimAndExit:
                         Expression = 0.0
                     End If
                 ElseIf Not Symbols.IsNumericType(typ) Then
-                    Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(typ), "Currency"))
+                    Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(typ), "Currency"))
                 End If
 
                 ifmt = CType(Expression, IFormattable)
@@ -1711,7 +1711,7 @@ RedimAndExit:
             If NumDigitsAfterDecimal = -1 Then
                 NumDigitsAfterDecimal = nfi.NumberDecimalDigits
             ElseIf (NumDigitsAfterDecimal > 99) OrElse (NumDigitsAfterDecimal < -1) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_Range0to99_1, "NumDigitsAfterDecimal"))
+                Throw New ArgumentException(SR.Format(SR.Argument_Range0to99_1, "NumDigitsAfterDecimal"))
             End If
 
             If GroupDigits = TriState.UseDefault Then
@@ -1812,7 +1812,7 @@ RedimAndExit:
             If typ Is GetType(System.String) Then
                 Expression = CDbl(Expression)
             ElseIf Not Symbols.IsNumericType(typ) Then
-                Throw New InvalidCastException(GetResourceString(SR.InvalidCast_FromTo, VBFriendlyName(typ), "numeric"))
+                Throw New InvalidCastException(SR.Format(SR.InvalidCast_FromTo, VBFriendlyName(typ), "numeric"))
             End If
 
             ifmt = CType(Expression, IFormattable)
@@ -1826,11 +1826,11 @@ RedimAndExit:
         '============================================================================
         Public Function GetChar(ByVal [str] As String, ByVal Index As Integer) As Char
             If [str] Is Nothing Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_LengthGTZero1, "String"))
+                Throw New ArgumentException(SR.Format(SR.Argument_LengthGTZero1, "String"))
             ElseIf (Index < 1) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_GEOne1, "Index"))
+                Throw New ArgumentException(SR.Format(SR.Argument_GEOne1, "Index"))
             ElseIf (Index > [str].Length) Then
-                Throw New ArgumentException(GetResourceString(SR.Argument_IndexLELength2, "Index", "String"))
+                Throw New ArgumentException(SR.Format(SR.Argument_IndexLELength2, "Index", "String"))
             Else
                 Return [str].Chars(Index - 1)
             End If
@@ -1983,7 +1983,7 @@ RedimAndExit:
                 ElseIf ([Compare] = CompareMethod.Text) Then
                     Return Operators.CompareString(String1, String2, True)
                 Else
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidValue1, "Compare"))
+                    Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Compare"))
                 End If
             Catch ex As Exception
                 Throw ex
@@ -2030,7 +2030,7 @@ RedimAndExit:
                     Catch ex As System.Threading.ThreadAbortException
                         Throw ex
                     Catch
-                        Throw New ArgumentException(GetResourceString(SR.Argument_LCIDNotSupported1, CStr(LocaleID)))
+                        Throw New ArgumentException(SR.Format(SR.Argument_LCIDNotSupported1, CStr(LocaleID)))
                     End Try
                 End If
 
@@ -2040,7 +2040,7 @@ RedimAndExit:
                 If (Conversion And Not (VbStrConv.Uppercase Or VbStrConv.Lowercase Or VbStrConv.Wide Or VbStrConv.Narrow _
                     Or VbStrConv.Katakana Or VbStrConv.Hiragana Or VbStrConv.SimplifiedChinese Or VbStrConv.TraditionalChinese _
                     Or VbStrConv.LinguisticCasing)) <> 0 Then
-                    Throw New ArgumentException(GetResourceString(SR.Argument_InvalidVbStrConv))
+                    Throw New ArgumentException(SR.Argument_InvalidVbStrConv)
                 End If
 
                 '*** VbStrConv.SimplifiedChinese/VbStrConv.TraditionalChinese handling
@@ -2049,18 +2049,18 @@ RedimAndExit:
                     Case 0
                         'Flags not used
                     Case (VbStrConv.SimplifiedChinese + VbStrConv.TraditionalChinese)
-                        Throw New ArgumentException(GetResourceString(SR.Argument_StrConvSCandTC))
+                        Throw New ArgumentException(SR.Argument_StrConvSCandTC)
                     Case VbStrConv.SimplifiedChinese
                         If IsValidCodePage(CODEPAGE_SIMPLIFIED_CHINESE) AndAlso IsValidCodePage(CODEPAGE_TRADITIONAL_CHINESE) Then
                             dwMapFlags = dwMapFlags Or NativeTypes.LCMAP_SIMPLIFIED_CHINESE
                         Else
-                            Throw New ArgumentException(GetResourceString(SR.Argument_SCNotSupported))
+                            Throw New ArgumentException(SR.Argument_SCNotSupported)
                         End If
                     Case VbStrConv.TraditionalChinese
                         If IsValidCodePage(CODEPAGE_SIMPLIFIED_CHINESE) AndAlso IsValidCodePage(CODEPAGE_TRADITIONAL_CHINESE) Then
                             dwMapFlags = dwMapFlags Or NativeTypes.LCMAP_TRADITIONAL_CHINESE
                         Else
-                            Throw New ArgumentException(GetResourceString(SR.Argument_TCNotSupported))
+                            Throw New ArgumentException(SR.Argument_TCNotSupported)
                         End If
                 End Select
 
@@ -2069,7 +2069,7 @@ RedimAndExit:
                     Case VbStrConv.None
                         'No conversion
                         If (Conversion And VbStrConv.LinguisticCasing) <> 0 Then
-                            Throw New ArgumentException(GetResourceString(SR.LinguisticRequirements))
+                            Throw New ArgumentException(SR.LinguisticRequirements)
                         End If
 
                     Case (VbStrConv.Uppercase Or VbStrConv.Lowercase)       '  VbStrConv.ProperCase is special: see below    
@@ -2091,7 +2091,7 @@ RedimAndExit:
 
                 If ((Conversion And (VbStrConv.Katakana + VbStrConv.Hiragana)) <> 0) Then
                     If (langid <> LANG_JAPANESE) OrElse (Not ValidLCID(LocaleID)) Then
-                        Throw New ArgumentException(GetResourceString(SR.Argument_JPNNotSupported))
+                        Throw New ArgumentException(SR.Argument_JPNNotSupported)
                     Else
                         'Locale is ok
                     End If
@@ -2102,10 +2102,10 @@ RedimAndExit:
                        (langid = LANG_KOREAN) OrElse
                        (langid = LANG_CHINESE) Then
                         If Not ValidLCID(LocaleID) Then
-                            Throw New ArgumentException(GetResourceString(SR.Argument_LocalNotSupported))
+                            Throw New ArgumentException(SR.Argument_LocalNotSupported)
                         End If
                     Else
-                        Throw New ArgumentException(GetResourceString(SR.Argument_WideNarrowNotApplicable))
+                        Throw New ArgumentException(SR.Argument_WideNarrowNotApplicable)
                     End If
                 End If
 
@@ -2113,7 +2113,7 @@ RedimAndExit:
                 Select Case (Conversion And (VbStrConv.Wide Or VbStrConv.Narrow))
                     Case VbStrConv.None
                     Case VbStrConv.Wide Or VbStrConv.Narrow  '  VbStrConv.Wide+VbStrConv.Narrow is reserved
-                        Throw New ArgumentException(GetResourceString(SR.Argument_IllegalWideNarrow))
+                        Throw New ArgumentException(SR.Argument_IllegalWideNarrow)
                     Case VbStrConv.Wide             '  VbStrConv.Wide
                         dwMapFlags = dwMapFlags Or NativeTypes.LCMAP_FULLWIDTH
                     Case VbStrConv.Narrow           '  VbStrConv.Narrow
@@ -2124,7 +2124,7 @@ RedimAndExit:
                 Select Case (Conversion And (VbStrConv.Katakana Or VbStrConv.Hiragana))
                     Case VbStrConv.None
                     Case (VbStrConv.Katakana Or VbStrConv.Hiragana)  '  VbStrConv.Katakana+VbStrConv.Hiragana is reserved
-                        Throw New ArgumentException(GetResourceString(SR.Argument_IllegalKataHira))
+                        Throw New ArgumentException(SR.Argument_IllegalKataHira)
                     Case VbStrConv.Katakana '  VbStrConv.Katakana
                         dwMapFlags = dwMapFlags Or NativeTypes.LCMAP_KATAKANA
                     Case VbStrConv.Hiragana '  VbStrConv.Hiragana
index 7c2310a..128cce6 100644 (file)
@@ -88,5 +88,16 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
             AssertExtensions.Throws<ArgumentOutOfRangeException>("sourceIndex", "srcIndex", () => Utils.CopyArray(array1, array2));
             AssertExtensions.Throws<ArgumentOutOfRangeException>("sourceIndex", "srcIndex", () => Utils.CopyArray(array2, array1));
         }
+
+        [Fact]
+        public void GetResourceString()
+        {
+            if (System.Threading.Thread.CurrentThread.CurrentCulture.Name == "en-US")
+            {
+                Assert.Equal("Argument '42' is not a valid value.", Utils.GetResourceString("Argument_InvalidValue1", "42"));
+                Assert.Equal("Argument '42' is not a valid value.", Utils.GetResourceString(ResourceKey: "Argument_InvalidValue1", Args: new[] { "42" }));
+                Assert.Equal("Application-defined or object-defined error.", Utils.GetResourceString("UnrecognizedResourceKey"));
+            }
+        }
     }
 }