diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs index 2a38561671c5afcf11ff5b13b43916f66df404ca..80357d35e424fa2dae658e04bb048cb4a09321f3 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionExceptionTests.cs @@ -416,8 +416,8 @@ private void AssertMessage(CompositionException exception, int rootCauseCount, C } else { - string option1 = string.Format(CultureInfo.CurrentCulture, SR.CompositionException_SingleErrorWithMultiplePaths, rootCauseCount); - string option2 = string.Format(CultureInfo.CurrentCulture, SR.CompositionException_MultipleErrorsWithMultiplePaths, rootCauseCount); + string option1 = SR.Format(SR.CompositionException_SingleErrorWithMultiplePaths, rootCauseCount); + string option2 = SR.Format(SR.CompositionException_MultipleErrorsWithMultiplePaths, rootCauseCount); if (!line.Contains(option1) && !line.Contains(option2)) { throw new XunitException($"`{line}` contains neither `{option1}` nor `{option2}`"); diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs index 707b6fbb5947f20ca7ed782e58733988ecc83043..af80a9994aa46cf72bdf276a21a8e782dc881ad4 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs @@ -288,7 +288,7 @@ public void ICompositionElementDisplayName_SingleTypeAsTypesArgument_ShouldInclu { var catalog = (ICompositionElement)CreateTypeCatalog(e); - string expected = string.Format(SR.TypeCatalog_DisplayNameFormat, typeof(TypeCatalog).Name, AttributedModelServices.GetTypeIdentity(e)); + string expected = SR.Format(SR.TypeCatalog_DisplayNameFormat, typeof(TypeCatalog).Name, AttributedModelServices.GetTypeIdentity(e)); Assert.Equal(expected, catalog.DisplayName); } @@ -334,7 +334,7 @@ public void ICompositionElementDisplayName_ShouldIncludeDerivedCatalogTypeNameAn { var catalog = (ICompositionElement)new DerivedTypeCatalog(e); - string expected = string.Format(SR.TypeCatalog_DisplayNameFormat, typeof(DerivedTypeCatalog).Name, AttributedModelServices.GetTypeIdentity(e)); + string expected = SR.Format(SR.TypeCatalog_DisplayNameFormat, typeof(DerivedTypeCatalog).Name, AttributedModelServices.GetTypeIdentity(e)); Assert.Equal(expected, catalog.DisplayName); } diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ExceptionUtilTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ExceptionUtilTests.cs index c563e85ae78f78c42ed7ad0534011222cf803428..30ef00abc65b4afcf00bc3cf8f6c4193cdd7b610 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ExceptionUtilTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ExceptionUtilTests.cs @@ -88,7 +88,7 @@ public void ParameterInvalid() ArgumentException e = ExceptionUtil.ParameterInvalid("foo"); Assert.NotNull(e); Assert.Equal("foo", e.ParamName); - Assert.StartsWith(string.Format(SR.GetResourceString("Parameter_Invalid", null), "foo"), e.Message); + Assert.StartsWith(SR.Format(SR.GetResourceString("Parameter_Invalid", null), "foo"), e.Message); } [Fact] @@ -97,7 +97,7 @@ public void ParameterNullOrEmpty() ArgumentException e = ExceptionUtil.ParameterNullOrEmpty("foo"); Assert.NotNull(e); Assert.Equal("foo", e.ParamName); - Assert.StartsWith(string.Format(SR.GetResourceString("Parameter_NullOrEmpty", null), "foo"), e.Message); + Assert.StartsWith(SR.Format(SR.GetResourceString("Parameter_NullOrEmpty", null), "foo"), e.Message); } [Fact] @@ -106,7 +106,7 @@ public void PropertyInvalid() ArgumentException e = ExceptionUtil.PropertyInvalid("foo"); Assert.NotNull(e); Assert.Equal("foo", e.ParamName); - Assert.StartsWith(string.Format(SR.GetResourceString("Property_Invalid", null), "foo"), e.Message); + Assert.StartsWith(SR.Format(SR.GetResourceString("Property_Invalid", null), "foo"), e.Message); } [Fact] @@ -115,7 +115,7 @@ public void PropertyNullOrEmpty() ArgumentException e = ExceptionUtil.PropertyNullOrEmpty("foo"); Assert.NotNull(e); Assert.Equal("foo", e.ParamName); - Assert.StartsWith(string.Format(SR.GetResourceString("Property_NullOrEmpty", null), "foo"), e.Message); + Assert.StartsWith(SR.Format(SR.GetResourceString("Property_NullOrEmpty", null), "foo"), e.Message); } [Fact] @@ -123,7 +123,7 @@ public void UnexpectedError() { InvalidOperationException e = ExceptionUtil.UnexpectedError("foo"); Assert.NotNull(e); - Assert.StartsWith(string.Format(SR.GetResourceString("Unexpected_Error", null), "foo"), e.Message); + Assert.StartsWith(SR.Format(SR.GetResourceString("Unexpected_Error", null), "foo"), e.Message); } } } diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs index 0b066544fade5e09c0a461238bfdec09922abb16..66f6c3a198e767c7555240b19b353488de077d3c 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs @@ -53,7 +53,7 @@ public void ValidateIntScalar(int value, int min, int max, int resolution, bool else { Assert.Equal( - string.Format(SR.GetResourceString(message, null), min, max), + SR.Format(SR.GetResourceString(message, null), min, max), AssertExtensions.Throws(null, action).Message); } } @@ -72,7 +72,7 @@ public void ValidateIntBadResolution(int value, int min, int max, int resolution else { Assert.Equal( - string.Format(SR.GetResourceString(message, null), resolution), + SR.Format(SR.GetResourceString(message, null), resolution), AssertExtensions.Throws(null, action).Message); } } diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs index 7c000011bf046212bc0726eb9d80aa9c34c6a3f6..f8ce9bcf1f91c5238149725c8992f3e530dd0fe8 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs @@ -127,7 +127,7 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known case KnownManagedType.DateTime when jsType == JSTypeFlags.Missing: case KnownManagedType.DateTimeOffset when jsType == JSTypeFlags.Missing: case KnownManagedType.Object when jsType == JSTypeFlags.Missing: - throw failWithReason(string.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); // nullable case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Boolean && jsType == JSTypeFlags.Boolean: return new NullableJSGenerator(MarshalerType.Boolean); @@ -157,10 +157,10 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int64 && jsType == JSTypeFlags.Missing: case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.DateTime && jsType == JSTypeFlags.Missing: case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.DateTimeOffset && jsType == JSTypeFlags.Missing: - throw failWithReason(string.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); case KnownManagedType.Nullable: - throw failWithReason(string.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); // task case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes.Length == 0 && jsTypeArguments[0] == JSTypeFlags.Void: return new TaskJSGenerator(MarshalerType.Void); @@ -200,10 +200,10 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.DateTime && jsType == JSTypeFlags.Missing: case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.DateTimeOffset && jsType == JSTypeFlags.Missing: case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Object && jsType == JSTypeFlags.Missing: - throw failWithReason(string.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1: - throw failWithReason(string.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); // array case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Byte && jsTypeArguments[0] == JSTypeFlags.Number: return new ArrayJSGenerator(MarshalerType.Byte); @@ -220,11 +220,11 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: return new ArrayJSGenerator(MarshalerType.Int32); case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.JSObject && jsType == JSTypeFlags.Missing: return new ArrayJSGenerator(MarshalerType.JSObject); case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1: - throw failWithReason(string.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); // array forced case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.Object && jsType == JSTypeFlags.Missing: - throw failWithReason(string.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); // span view case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView && jsTypeArguments.Length != 0: @@ -234,13 +234,13 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Double: return new SpanJSGenerator(MarshalerType.Double); case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView: - throw failWithReason(string.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); // span forced case KnownManagedType.Span when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Missing: case KnownManagedType.Span when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: case KnownManagedType.Span when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Missing: - throw failWithReason(string.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); // segment view case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView && jsTypeArguments.Length != 0: @@ -249,13 +249,13 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Int32: return new ArraySegmentJSGenerator(MarshalerType.Int32); case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Double: return new ArraySegmentJSGenerator(MarshalerType.Double); case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView: - throw failWithReason(string.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); // segment forced case KnownManagedType.ArraySegment when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Missing: case KnownManagedType.ArraySegment when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: case KnownManagedType.ArraySegment when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Missing: - throw failWithReason(string.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); // function + action case KnownManagedType.Function when jsType == JSTypeFlags.Function && jsTypeArguments.Length == argumentTypes.Length: @@ -273,7 +273,7 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known || argumentTypes[i] == KnownManagedType.Unknown ) { - throw failWithReason(string.Format(SR.FuncArgumentNotSupported, argumentTypes[i])); + throw failWithReason(SR.Format(SR.FuncArgumentNotSupported, argumentTypes[i])); } var gen = Create(info, isToJs ^ (!isReturn), argumentTypes[i], Array.Empty(), jsTypeArguments[i], Array.Empty(), failWithReason); argsMarshalers.Add(gen.Type); @@ -297,13 +297,13 @@ internal static BaseJSGenerator Create(TypePositionInfo info, bool isToJs, Known || argumentTypes[i] == KnownManagedType.Unknown ) { - throw failWithReason(string.Format(SR.FuncArgumentNotSupported, argumentTypes[i])); + throw failWithReason(SR.Format(SR.FuncArgumentNotSupported, argumentTypes[i])); } } - throw failWithReason(string.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); default: - throw failWithReason(string.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + throw failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); } } } diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportFixer.cs b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportFixer.cs index 4fdedd095bed8d57dfdd838fe18825ab18238509..14059607d30e5120b64e2962fa36916a18232433 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportFixer.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportFixer.cs @@ -119,7 +119,7 @@ public CodeAction CreateConvertToLibraryImportCodeFix(Document document, MethodD public CodeAction CreateConvertToLibraryImportWithSuffixCodeFix(Document document, MethodDeclarationSyntax methodSyntax, char suffix, bool mayRequireAdditionalWork) { return CodeAction.Create( - string.Format(SR.ConvertToLibraryImportWithSuffix, suffix), + SR.Format(SR.ConvertToLibraryImportWithSuffix, suffix), cancelToken => ConvertToLibraryImport( document, methodSyntax, @@ -155,7 +155,7 @@ public CodeAction CreateConvertToLibraryImportCodeFix(Document document, MethodD public CodeAction CreateConvertToLibraryImportWithSuffixCodeFix(Document document, MethodDeclarationSyntax methodSyntax, char suffix, bool mayRequireAdditionalWork) { return CodeAction.Create( - string.Format(SR.ConvertToLibraryImportWithSuffixAddUnsafe, suffix), + SR.Format(SR.ConvertToLibraryImportWithSuffixAddUnsafe, suffix), async cancelToken => { Solution solutionWithUnsafe = AddUnsafe(document.Project.Solution, document.Project); diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/AttributedMarshallingModelGeneratorFactory.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/AttributedMarshallingModelGeneratorFactory.cs index 3325e92cbce81f6a3776890e9b489dcbd8278c7a..27f13e68272b406eca4766cb14d23ad011f0b45c 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/AttributedMarshallingModelGeneratorFactory.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/AttributedMarshallingModelGeneratorFactory.cs @@ -379,7 +379,7 @@ private void ValidateCustomNativeTypeMarshallingSupported(TypePositionInfo info, { throw new MarshallingNotSupportedException(info, context) { - NotSupportedDetails = string.Format(SR.UnmanagedToManagedMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) + NotSupportedDetails = SR.Format(SR.UnmanagedToManagedMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) }; } @@ -388,7 +388,7 @@ private void ValidateCustomNativeTypeMarshallingSupported(TypePositionInfo info, { throw new MarshallingNotSupportedException(info, context) { - NotSupportedDetails = string.Format(SR.BidirectionalMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) + NotSupportedDetails = SR.Format(SR.BidirectionalMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) }; } @@ -398,7 +398,7 @@ private void ValidateCustomNativeTypeMarshallingSupported(TypePositionInfo info, { throw new MarshallingNotSupportedException(info, context) { - NotSupportedDetails = string.Format(SR.ManagedToUnmanagedMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) + NotSupportedDetails = SR.Format(SR.ManagedToUnmanagedMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) }; } @@ -410,7 +410,7 @@ private void ValidateCustomNativeTypeMarshallingSupported(TypePositionInfo info, { throw new MarshallingNotSupportedException(info, context) { - NotSupportedDetails = string.Format(SR.ManagedToUnmanagedMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) + NotSupportedDetails = SR.Format(SR.ManagedToUnmanagedMissingRequiredMarshaller, marshalInfo.EntryPointType.FullTypeName) }; } } diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/CharMarshallingGeneratorFactory.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/CharMarshallingGeneratorFactory.cs index 3f9e246e908792fada48644b95d8fb04e0ebe922..f24c1235a7ac7a366be2a0b6236c6c7a03ab67d9 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/CharMarshallingGeneratorFactory.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/CharMarshallingGeneratorFactory.cs @@ -64,7 +64,7 @@ private IMarshallingGenerator CreateCharMarshaller(TypePositionInfo info, StubCo case CharEncoding.Utf8: throw new MarshallingNotSupportedException(info, context) // [Compat] UTF-8 is not supported for char { - NotSupportedDetails = string.Format(SR.MarshallingCharAsSpecifiedStringMarshallingNotSupported, nameof(CharEncoding.Utf8)) + NotSupportedDetails = SR.Format(SR.MarshallingCharAsSpecifiedStringMarshallingNotSupported, nameof(CharEncoding.Utf8)) }; case CharEncoding.Custom: throw new MarshallingNotSupportedException(info, context) diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs index 1bd97516b705cbb55cecf6ea46001e7cd56782c8..3911d8a30691da156b71b931867a952edbc87dd4 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs @@ -1218,7 +1218,7 @@ private static string EscapeAscii(string path) builder.Append(c); break; default: - builder.Append(string.Format($"%{((int)c):X2}")); + builder.AppendFormat("%{0:X2}", (int)c); break; } }