From 44d3966fdd4bd865a7f105ef692d9cc2a7cae26a Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 2 Jan 2019 19:57:17 -0500 Subject: [PATCH] Replace string.Format(SR. with SR.Format(SR. (dotnet/coreclr#21763) We use SR.Format in almost all places where we format resource strings (without a format provider), but there were a few stragglers. Commit migrated from https://github.com/dotnet/coreclr/commit/369f53ea121798a65b81e6878c739c6bdcaae895 --- src/libraries/System.Private.CoreLib/src/System/Convert.cs | 8 ++++---- .../src/System/Threading/ManualResetEventSlim.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Convert.cs b/src/libraries/System.Private.CoreLib/src/System/Convert.cs index 1c303d2..077dda9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Convert.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Convert.cs @@ -306,7 +306,7 @@ namespace System if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Empty])) throw new InvalidCastException(SR.InvalidCast_Empty); - throw new InvalidCastException(string.Format(SR.InvalidCast_FromTo, value.GetType().FullName, targetType.FullName)); + throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, value.GetType().FullName, targetType.FullName)); } public static object ChangeType(object value, Type conversionType) @@ -2412,7 +2412,7 @@ namespace System { if (options < Base64FormattingOptions.None || options > Base64FormattingOptions.InsertLineBreaks) { - throw new ArgumentException(string.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options)); + throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options)); } if (bytes.Length == 0) @@ -2457,7 +2457,7 @@ namespace System if (options < Base64FormattingOptions.None || options > Base64FormattingOptions.InsertLineBreaks) { - throw new ArgumentException(string.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options)); + throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options)); } @@ -2500,7 +2500,7 @@ namespace System { if (options < Base64FormattingOptions.None || options > Base64FormattingOptions.InsertLineBreaks) { - throw new ArgumentException(string.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options)); + throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options)); } if (bytes.Length == 0) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs index dd3de83..18eee25 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs @@ -148,7 +148,7 @@ namespace System.Threading // it is possible for the max number of waiters to be exceeded via user-code, hence we use a real exception here. if (value >= NumWaitersState_MaxValue) - throw new InvalidOperationException(string.Format(SR.ManualResetEventSlim_ctor_TooManyWaiters, NumWaitersState_MaxValue)); + throw new InvalidOperationException(SR.Format(SR.ManualResetEventSlim_ctor_TooManyWaiters, NumWaitersState_MaxValue)); UpdateStateAtomically(value << NumWaitersState_ShiftCount, NumWaitersState_BitMask); } @@ -203,7 +203,7 @@ namespace System.Threading { throw new ArgumentOutOfRangeException( nameof(spinCount), - string.Format(SR.ManualResetEventSlim_ctor_SpinCountOutOfRange, SpinCountState_MaxValue)); + SR.Format(SR.ManualResetEventSlim_ctor_SpinCountOutOfRange, SpinCountState_MaxValue)); } // We will suppress default spin because the user specified a count. -- 2.7.4