diff --git a/src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs index afc3fca603c1f7..4222b730e73e6e 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs @@ -726,9 +726,9 @@ public static unsafe void RegisterNoGCRegionCallback(long totalSize, Action call switch (status) { case EnableNoGCRegionCallbackStatus.NotStarted: - throw new InvalidOperationException(SR.Format(SR.InvalidOperationException_NoGCRegionNotInProgress)); + throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionNotInProgress); case EnableNoGCRegionCallbackStatus.InsufficientBudget: - throw new InvalidOperationException(SR.Format(SR.InvalidOperationException_NoGCRegionAllocationExceeded)); + throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionAllocationExceeded); case EnableNoGCRegionCallbackStatus.AlreadyRegistered: throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionCallbackAlreadyRegistered); } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/GC.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/GC.NativeAot.cs index 6043e60afd02f9..ae30940b08a8df 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/GC.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/GC.NativeAot.cs @@ -332,9 +332,9 @@ public static unsafe void RegisterNoGCRegionCallback(long totalSize, Action call switch (status) { case EnableNoGCRegionCallbackStatus.NotStarted: - throw new InvalidOperationException(SR.Format(SR.InvalidOperationException_NoGCRegionNotInProgress)); + throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionNotInProgress); case EnableNoGCRegionCallbackStatus.InsufficientBudget: - throw new InvalidOperationException(SR.Format(SR.InvalidOperationException_NoGCRegionAllocationExceeded)); + throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionAllocationExceeded); case EnableNoGCRegionCallbackStatus.AlreadyRegistered: throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionCallbackAlreadyRegistered); } diff --git a/src/libraries/System.Data.OleDb/src/OleDb_Util.cs b/src/libraries/System.Data.OleDb/src/OleDb_Util.cs index 9dba6cb936f3c4..148b1a19a552a7 100644 --- a/src/libraries/System.Data.OleDb/src/OleDb_Util.cs +++ b/src/libraries/System.Data.OleDb/src/OleDb_Util.cs @@ -192,11 +192,11 @@ internal static OleDbException NoErrorInformation(string? provider, OleDbHResult } internal static InvalidOperationException MDACNotAvailable(Exception? inner) { - return ADP.DataAdapter(SR.Format(SR.OleDb_MDACNotAvailable), inner); + return ADP.DataAdapter(SR.OleDb_MDACNotAvailable, inner); } internal static ArgumentException MSDASQLNotSupported() { - return ADP.Argument(SR.Format(SR.OleDb_MSDASQLNotSupported)); + return ADP.Argument(SR.OleDb_MSDASQLNotSupported); } internal static InvalidOperationException CommandTextNotSupported(string provider, Exception? inner) { @@ -204,7 +204,7 @@ internal static InvalidOperationException CommandTextNotSupported(string provide } internal static InvalidOperationException PossiblePromptNotUserInteractive() { - return ADP.DataAdapter(SR.Format(SR.OleDb_PossiblePromptNotUserInteractive)); + return ADP.DataAdapter(SR.OleDb_PossiblePromptNotUserInteractive); } internal static InvalidOperationException ProviderUnavailable(string provider, Exception? inner) { @@ -217,27 +217,27 @@ internal static InvalidOperationException TransactionsNotSupported(string provid } internal static ArgumentException AsynchronousNotSupported() { - return ADP.Argument(SR.Format(SR.OleDb_AsynchronousNotSupported)); + return ADP.Argument(SR.OleDb_AsynchronousNotSupported); } internal static ArgumentException NoProviderSpecified() { - return ADP.Argument(SR.Format(SR.OleDb_NoProviderSpecified)); + return ADP.Argument(SR.OleDb_NoProviderSpecified); } internal static ArgumentException InvalidProviderSpecified() { - return ADP.Argument(SR.Format(SR.OleDb_InvalidProviderSpecified)); + return ADP.Argument(SR.OleDb_InvalidProviderSpecified); } internal static ArgumentException InvalidRestrictionsDbInfoKeywords(string parameter) { - return ADP.Argument(SR.Format(SR.OleDb_InvalidRestrictionsDbInfoKeywords), parameter); + return ADP.Argument(SR.OleDb_InvalidRestrictionsDbInfoKeywords, parameter); } internal static ArgumentException InvalidRestrictionsDbInfoLiteral(string parameter) { - return ADP.Argument(SR.Format(SR.OleDb_InvalidRestrictionsDbInfoLiteral), parameter); + return ADP.Argument(SR.OleDb_InvalidRestrictionsDbInfoLiteral, parameter); } internal static ArgumentException InvalidRestrictionsSchemaGuids(string parameter) { - return ADP.Argument(SR.Format(SR.OleDb_InvalidRestrictionsSchemaGuids), parameter); + return ADP.Argument(SR.OleDb_InvalidRestrictionsSchemaGuids, parameter); } internal static ArgumentException NotSupportedSchemaTable(Guid schema, OleDbConnection connection) { @@ -253,7 +253,7 @@ internal static Exception InvalidOleDbType(OleDbType value) // Getting Data internal static InvalidOperationException BadAccessor() { - return ADP.DataAdapter(SR.Format(SR.OleDb_BadAccessor)); + return ADP.DataAdapter(SR.OleDb_BadAccessor); } internal static InvalidCastException ConversionRequired() { @@ -261,7 +261,7 @@ internal static InvalidCastException ConversionRequired() } internal static InvalidCastException CantConvertValue() { - return ADP.InvalidCast(SR.Format(SR.OleDb_CantConvertValue)); + return ADP.InvalidCast(SR.OleDb_CantConvertValue); } internal static InvalidOperationException SignMismatch(Type type) { @@ -299,13 +299,13 @@ internal static InvalidOperationException BadStatusRowAccessor(int i, DBBindStat } internal static InvalidOperationException ThreadApartmentState(Exception innerException) { - return ADP.InvalidOperation(SR.Format(SR.OleDb_ThreadApartmentState), innerException); + return ADP.InvalidOperation(SR.OleDb_ThreadApartmentState, innerException); } // OleDbDataAdapter internal static ArgumentException Fill_NotADODB(string parameter) { - return ADP.Argument(SR.Format(SR.OleDb_Fill_NotADODB), parameter); + return ADP.Argument(SR.OleDb_Fill_NotADODB, parameter); } internal static ArgumentException Fill_EmptyRecordSet(string parameter, Exception innerException) { @@ -313,7 +313,7 @@ internal static ArgumentException Fill_EmptyRecordSet(string parameter, Exceptio } internal static ArgumentException Fill_EmptyRecord(string parameter, Exception innerException) { - return ADP.Argument(SR.Format(SR.OleDb_Fill_EmptyRecord), parameter, innerException); + return ADP.Argument(SR.OleDb_Fill_EmptyRecord, parameter, innerException); } internal static string NoErrorMessage(OleDbHResult errorcode) @@ -331,7 +331,7 @@ internal static string FailedGetSource(OleDbHResult errorcode) internal static InvalidOperationException DBBindingGetVector() { - return ADP.InvalidOperation(SR.Format(SR.OleDb_DBBindingGetVector)); + return ADP.InvalidOperation(SR.OleDb_DBBindingGetVector); } internal static OleDbHResult GetErrorDescription(UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResult hresult, out string message) @@ -357,7 +357,7 @@ internal static ArgumentException ISourcesRowsetNotSupported() // OleDbMetaDataFactory internal static InvalidOperationException IDBInfoNotSupported() { - return ADP.InvalidOperation(SR.Format(SR.OleDb_IDBInfoNotSupported)); + return ADP.InvalidOperation(SR.OleDb_IDBInfoNotSupported); } // explicitly used error codes diff --git a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.Read.cs b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.Read.cs index 7c137b27965f05..b2c3d6b6721b66 100644 --- a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.Read.cs +++ b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.Read.cs @@ -400,7 +400,7 @@ private async Task ProcessDataBlockAsync(Stream archiveStream, bool copyData, Ca long size = TarHelpers.ParseNumeric(buffer.Slice(FieldLocations.Size, FieldLengths.Size)); if (size < 0) { - throw new InvalidDataException(SR.Format(SR.TarSizeFieldNegative)); + throw new InvalidDataException(SR.TarSizeFieldNegative); } // Continue with the rest of the fields that require no special checks @@ -680,7 +680,7 @@ private void ReadExtendedAttributesFromBuffer(ReadOnlySpan buffer, string if (buffer.Length > 0) { - throw new InvalidDataException(SR.Format(SR.ExtHeaderInvalidRecords)); + throw new InvalidDataException(SR.ExtHeaderInvalidRecords); } } diff --git a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHelpers.cs b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHelpers.cs index 77cfc47de0bf70..fc4c053773aa9c 100644 --- a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHelpers.cs +++ b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHelpers.cs @@ -268,7 +268,7 @@ internal static T ParseOctal(ReadOnlySpan buffer) where T : struct, INu [DoesNotReturn] private static void ThrowInvalidNumber() => - throw new InvalidDataException(SR.Format(SR.TarInvalidNumber)); + throw new InvalidDataException(SR.TarInvalidNumber); // Returns the null-terminated UTF8 string contained in the specified buffer. internal static string ParseUtf8String(ReadOnlySpan buffer) diff --git a/src/libraries/System.Formats.Tar/tests/TarEntry/GnuTarEntry.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarEntry/GnuTarEntry.Tests.cs index 52ea9dd532afed..c5848f7b3ed111 100644 --- a/src/libraries/System.Formats.Tar/tests/TarEntry/GnuTarEntry.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarEntry/GnuTarEntry.Tests.cs @@ -926,7 +926,7 @@ private static T ParseOctal(ReadOnlySpan buffer) where T : struct, INum uint digit = (uint)(b - '0'); if (digit >= 8) { - throw new InvalidDataException(SR.Format(SR.TarInvalidNumber)); + throw new InvalidDataException(SR.TarInvalidNumber); } value = checked((value * octalFactor) + T.CreateTruncating(digit)); diff --git a/src/libraries/System.Private.DataContractSerialization/src/Resources/Strings.resx b/src/libraries/System.Private.DataContractSerialization/src/Resources/Strings.resx index 381a4a0c3db6a6..ee432ec5d4dc94 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/Resources/Strings.resx +++ b/src/libraries/System.Private.DataContractSerialization/src/Resources/Strings.resx @@ -1243,7 +1243,7 @@ Cannot import null XmlSchema contained in XmlSchemaSet specified via parameter. - An internal error has occurred. Could not load serialization schema. Consider providing schema with namespace '{0}'. + Complex type restriction is not supported. Default value on element '{0}' is not supported. diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs index 1a1819be2bcc64..ad295017844ebc 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs @@ -323,7 +323,7 @@ private Dictionary GetReferencedTypes() foreach (Type type in _referencedTypes) { if (type == null) - throw new InvalidOperationException(SR.Format(SR.ReferencedTypesCannotContainNull)); + throw new InvalidOperationException(SR.ReferencedTypesCannotContainNull); AddReferencedType(_referencedTypesDictionary, type); } @@ -344,7 +344,7 @@ private Dictionary GetReferencedCollectionTypes() foreach (Type type in _referencedCollectionTypes) { if (type == null) - throw new InvalidOperationException(SR.Format(SR.ReferencedCollectionTypesCannotContainNull)); + throw new InvalidOperationException(SR.ReferencedCollectionTypesCannotContainNull); AddReferencedType(_referencedCollectionTypesDictionary, type); } } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ExtensionDataReader.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ExtensionDataReader.cs index cc36e1f9aa59e2..ad0d50f9c0311e 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ExtensionDataReader.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ExtensionDataReader.cs @@ -472,7 +472,7 @@ private void MoveNext(IDataNode? dataNode) else { Debug.Fail("Encountered invalid data node when deserializing unknown data"); - throw new SerializationException(SR.Format(SR.InvalidStateInExtensionDataReader)); + throw new SerializationException(SR.InvalidStateInExtensionDataReader); } break; } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/SchemaImporter.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/SchemaImporter.cs index 3ae22f86530f97..4d30542266d85b 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/SchemaImporter.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/SchemaImporter.cs @@ -62,7 +62,7 @@ internal void Import([NotNullIfNotNull(nameof(_elements))] out List 1) - ThrowISerializableTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.ISerializableContainsMoreThanOneItems)); + ThrowISerializableTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.ISerializableContainsMoreThanOneItems); XmlSchemaObject o = rootSequence.Items[0]; if (!(o is XmlSchemaAny)) - ThrowISerializableTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.ISerializableDoesNotContainAny)); + ThrowISerializableTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.ISerializableDoesNotContainAny); XmlSchemaAny wildcard = (XmlSchemaAny)o; XmlSchemaAny iSerializableWildcardElement = SchemaExporter.ISerializableWildcardElement; @@ -1170,19 +1170,19 @@ private static bool IsDictionary(XmlQualifiedName typeName, XmlSchemaAnnotation? { XmlSchemaSimpleType? anonymousType = list.ItemType; if (anonymousType == null) - ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.EnumListMustContainAnonymousType)); + ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.EnumListMustContainAnonymousType); XmlSchemaSimpleTypeContent? content = anonymousType.Content; if (content is XmlSchemaSimpleTypeUnion) - ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.EnumUnionInAnonymousTypeNotSupported)); + ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.EnumUnionInAnonymousTypeNotSupported); else if (content is XmlSchemaSimpleTypeList) - ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.EnumListInAnonymousTypeNotSupported)); + ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.EnumListInAnonymousTypeNotSupported); else if (content is XmlSchemaSimpleTypeRestriction) { if (content is XmlSchemaSimpleTypeRestriction restriction && CheckIfEnum(restriction)) return ImportEnum(typeName, restriction, true /*isFlags*/, annotation); else - ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.EnumRestrictionInvalid)); + ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.EnumRestrictionInvalid); } return null; } @@ -1204,9 +1204,9 @@ private EnumDataContract ImportEnum(XmlQualifiedName typeName, XmlSchemaSimpleTy { XmlSchemaEnumerationFacet? enumFacet = facet as XmlSchemaEnumerationFacet; if (enumFacet == null) - ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.EnumOnlyEnumerationFacetsSupported)); + ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.EnumOnlyEnumerationFacetsSupported); if (enumFacet.Value == null) - ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.EnumEnumerationFacetsMustHaveValue)); + ThrowEnumTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.EnumEnumerationFacetsMustHaveValue); string? valueInnerText = GetInnerText(typeName, ImportAnnotation(enumFacet.Annotation, SchemaExporter.EnumerationValueAnnotationName)); long enumValue = (valueInnerText == null) ? SchemaExporter.GetDefaultEnumValue(isFlags, dataContract.Members.Count) @@ -1229,7 +1229,7 @@ private DataContract ImportSimpleTypeRestriction(XmlQualifiedName typeName, XmlS else if (restriction.BaseType != null) dataContract = ImportType(restriction.BaseType); else - ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.SimpleTypeRestrictionDoesNotSpecifyBase)); + ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.SimpleTypeRestrictionDoesNotSpecifyBase); return dataContract; } @@ -1344,9 +1344,9 @@ private static GenericInfo ImportGenericInfo(XmlElement typeElement, XmlSchemaTy private static void CheckComplexType(XmlQualifiedName typeName, XmlSchemaComplexType type) { if (type.IsAbstract) - ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.AbstractTypeNotSupported)); + ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.AbstractTypeNotSupported); if (type.IsMixed) - ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.MixedContentNotSupported)); + ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.MixedContentNotSupported); } private static void CheckIfElementUsesUnsupportedConstructs(XmlQualifiedName typeName, XmlSchemaElement element) @@ -1364,7 +1364,7 @@ private static void CheckIfElementUsesUnsupportedConstructs(XmlQualifiedName typ private static void ImportAttributes(XmlQualifiedName typeName, XmlSchemaObjectCollection attributes, XmlSchemaAnyAttribute? anyAttribute, out bool isReference) { if (anyAttribute != null) - ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.Format(SR.AnyAttributeNotSupported)); + ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, SR.AnyAttributeNotSupported); isReference = false; if (attributes != null) diff --git a/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs b/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs index 2f58b0045075c8..3be45eca1a9bbf 100644 --- a/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs +++ b/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs @@ -139,7 +139,7 @@ public int GetValueAsInt32() if (reader.BytesRemaining != 0) { - throw new InvalidOperationException(SR.Format(SR.CoseHeaderMapCborEncodedValueNotValid)); + throw new InvalidOperationException(SR.CoseHeaderMapCborEncodedValueNotValid); } return retVal; @@ -166,7 +166,7 @@ public string GetValueAsString() if (reader.BytesRemaining != 0) { - throw new InvalidOperationException(SR.Format(SR.CoseHeaderMapCborEncodedValueNotValid)); + throw new InvalidOperationException(SR.CoseHeaderMapCborEncodedValueNotValid); } return retVal; @@ -193,7 +193,7 @@ public byte[] GetValueAsBytes() if (reader.BytesRemaining != 0) { - throw new InvalidOperationException(SR.Format(SR.CoseHeaderMapCborEncodedValueNotValid)); + throw new InvalidOperationException(SR.CoseHeaderMapCborEncodedValueNotValid); } return retVal; @@ -225,7 +225,7 @@ public int GetValueAsBytes(Span destination) if (reader.BytesRemaining != 0) { - throw new InvalidOperationException(SR.Format(SR.CoseHeaderMapCborEncodedValueNotValid)); + throw new InvalidOperationException(SR.CoseHeaderMapCborEncodedValueNotValid); } return bytesWritten; diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs b/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs index cc432b238659d0..74cc50340aa694 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs @@ -332,7 +332,7 @@ public static void ThrowJsonException_DuplicatePropertyNotAllowed(JsonPropertyIn [DoesNotReturn] public static void ThrowJsonException_DuplicatePropertyNotAllowed() { - throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed)); + throw new JsonException(SR.DuplicatePropertiesNotAllowed); } [DoesNotReturn] @@ -549,7 +549,7 @@ public static void AddJsonExceptionInformation(ref WriteStack state, JsonExcepti if (string.IsNullOrEmpty(message)) { // Use a default message. - message = SR.Format(SR.SerializeUnableToSerialize); + message = SR.SerializeUnableToSerialize; ex.AppendPathInformation = true; } @@ -727,7 +727,7 @@ public static void ThrowJsonException_MetadataReferenceObjectCannotContainOtherP public static void ThrowJsonException_MetadataUnexpectedProperty(ReadOnlySpan propertyName, scoped ref ReadStack state) { state.Current.JsonPropertyName = propertyName.ToArray(); - ThrowJsonException(SR.Format(SR.MetadataUnexpectedProperty)); + ThrowJsonException(SR.MetadataUnexpectedProperty); } [DoesNotReturn] diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs b/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs index a5ddfa5b976e60..2dbdf680c75701 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs @@ -483,7 +483,7 @@ private static string GetResourceString(ref Utf8JsonReader json, ExceptionResour message = SR.EndOfCommentNotFound; break; case ExceptionResource.ZeroDepthAtEnd: - message = SR.Format(SR.ZeroDepthAtEnd); + message = SR.ZeroDepthAtEnd; break; case ExceptionResource.ExpectedJsonTokens: message = SR.ExpectedJsonTokens; @@ -498,10 +498,10 @@ private static string GetResourceString(ref Utf8JsonReader json, ExceptionResour message = SR.Format(SR.InvalidCharacterAtStartOfComment, character); break; case ExceptionResource.UnexpectedEndOfDataWhileReadingComment: - message = SR.Format(SR.UnexpectedEndOfDataWhileReadingComment); + message = SR.UnexpectedEndOfDataWhileReadingComment; break; case ExceptionResource.UnexpectedEndOfLineSeparator: - message = SR.Format(SR.UnexpectedEndOfLineSeparator); + message = SR.UnexpectedEndOfLineSeparator; break; case ExceptionResource.InvalidLeadingZeroInNumber: message = SR.Format(SR.InvalidLeadingZeroInNumber, character); @@ -631,7 +631,7 @@ private static string GetResourceString(ExceptionResource resource, int currentD break; case ExceptionResource.CannotWritePropertyWithinArray: message = (tokenType == JsonTokenType.PropertyName) ? - SR.Format(SR.CannotWritePropertyAfterProperty) : + SR.CannotWritePropertyAfterProperty : SR.Format(SR.CannotWritePropertyWithinArray, tokenType); break; case ExceptionResource.CannotWriteValueAfterPrimitiveOrClose: