120 references to Format
System.Text.Json (120)
System\Text\Json\Document\JsonElement.cs (3)
143throw new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, propertyName)); 181throw new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, propertyName.ToString())); 221throw new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, Encoding.UTF8.GetString(utf8PropertyName)));
System\Text\Json\Nodes\JsonArray.cs (1)
199_ => throw new InvalidOperationException(SR.Format(SR.NodeElementWrongType, nameof(JsonValueKind.Array))),
System\Text\Json\Nodes\JsonNode.cs (1)
200throw new InvalidOperationException(SR.Format(SR.NodeWrongType, nameof(JsonValue)));
System\Text\Json\Nodes\JsonObject.cs (1)
65_ => throw new InvalidOperationException(SR.Format(SR.NodeElementWrongType, nameof(JsonValueKind.Object)))
System\Text\Json\Serialization\Converters\Value\UnsupportedTypeConverter.cs (1)
15public string ErrorMessage => _errorMessage ?? SR.Format(SR.SerializeTypeInstanceNotSupported, typeof(T).FullName);
System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Helpers.cs (1)
403failureReason = SR.Format(SR.Polymorphism_OpenGeneric_Reason_UnboundParameter, required.Name);
System\Text\Json\ThrowHelper.cs (51)
66throw new ArgumentOutOfRangeException(nameof(typeToConvert), SR.Format(SR.SerializerConverterFactoryInvalidArgument, typeToConvert.FullName)); 100return GetInvalidOperationException(SR.Format(SR.CallFlushToAvoidDataLoss, _buffered)); 112throw GetArgumentException(SR.Format(SR.PropertyNameTooLarge, tokenLength)); 118throw GetArgumentException(SR.Format(SR.ValueTooLarge, tokenLength)); 136throw GetArgumentException(SR.Format(SR.PropertyNameTooLarge, length)); 144ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 149ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 158ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 163ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 172ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 177ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 186ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 191ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length)); 206ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 259ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length)); 342return GetInvalidOperationException(SR.Format(SR.InvalidComparison, tokenType)); 405message = SR.Format(SR.ArrayDepthTooLarge, json.CurrentState.Options.MaxDepth); 408message = SR.Format(SR.MismatchedObjectArray, character); 420message = SR.Format(SR.RequiredDigitNotFoundAfterSign, character); 423message = SR.Format(SR.RequiredDigitNotFoundAfterDecimal, character); 429message = SR.Format(SR.ExpectedEndAfterSingleJson, character); 432message = SR.Format(SR.ExpectedEndOfDigitNotFound, character); 435message = SR.Format(SR.ExpectedNextDigitEValueNotFound, character); 438message = SR.Format(SR.ExpectedSeparatorAfterPropertyNameNotFound, character); 441message = SR.Format(SR.ExpectedStartOfPropertyNotFound, character); 447message = SR.Format(SR.ExpectedStartOfPropertyOrValueAfterComment, character); 450message = SR.Format(SR.ExpectedStartOfValueNotFound, character); 456message = SR.Format(SR.FoundInvalidCharacter, character); 459message = SR.Format(SR.InvalidEndOfJsonNonPrimitive, json.TokenType); 462message = SR.Format(SR.ObjectDepthTooLarge, json.CurrentState.Options.MaxDepth); 465message = SR.Format(SR.ExpectedFalse, characters); 468message = SR.Format(SR.ExpectedNull, characters); 471message = SR.Format(SR.ExpectedTrue, characters); 474message = SR.Format(SR.InvalidCharacterWithinString, character); 477message = SR.Format(SR.InvalidCharacterAfterEscapeWithinString, character); 480message = SR.Format(SR.InvalidHexCharacterWithinString, character); 498message = SR.Format(SR.InvalidCharacterAtStartOfComment, character); 507message = SR.Format(SR.InvalidLeadingZeroInNumber, character); 554throw new ArgumentException(SR.Format(SR.CannotEncodeInvalidUTF8, builder)); 560throw new ArgumentException(SR.Format(SR.CannotEncodeInvalidUTF16, $"0x{charAsInt:X2}")); 566throw GetInvalidOperationException(SR.Format(SR.CannotReadInvalidUTF16, $"0x{charAsInt:X2}")); 604throw new OutOfMemoryException(SR.Format(SR.BufferMaximumSizeExceeded, capacity)); 617SR.Format(SR.CannotWriteEndAfterProperty, (char)token) : 618SR.Format(SR.MismatchedObjectArray, (char)token); 624message = SR.Format(SR.CannotStartObjectArrayWithoutProperty, tokenType); 627message = SR.Format(SR.CannotStartObjectArrayAfterPrimitiveOrClose, tokenType); 630message = SR.Format(SR.CannotWriteValueWithinObject, tokenType); 635SR.Format(SR.CannotWritePropertyWithinArray, tokenType); 638message = SR.Format(SR.CannotWriteValueAfterPrimitiveOrClose, tokenType); 660throw new FormatException(SR.Format(SR.FormatNumericType, numericType)) { Source = ExceptionSourceValueToRethrowAsJsonException }; 678message = SR.Format(SR.UnsupportedFormat, dataType);
System\Text\Json\ThrowHelper.Node.cs (3)
22throw new ArgumentException(SR.Format(SR.NodeDuplicateKey, propertyName), paramName); 60throw new InvalidOperationException(SR.Format(SR.NodeWrongType, concatenatedNames)); 66throw new InvalidOperationException(SR.Format(SR.NodeParentWrongType, typeName));
System\Text\Json\ThrowHelper.Serialization.cs (56)
34throw new NotSupportedException(SR.Format(SR.SerializationNotSupportedType, propertyType)); 40throw new NotSupportedException(SR.Format(SR.TypeRequiresAsyncSerialization, propertyType)); 52throw new JsonException(SR.Format(SR.DeserializeUnableToConvertValue, propertyType)) { AppendPathInformation = true }; 64throw new InvalidOperationException(SR.Format(SR.DeserializeUnableToAssignNull, declaredType)); 130throw new JsonException(SR.Format(SR.SerializationConverterRead, converter)) { AppendPathInformation = true }; 136throw new JsonException(SR.Format(SR.SerializationConverterWrite, converter)) { AppendPathInformation = true }; 142throw new JsonException(SR.Format(SR.SerializerCycleDetected, maxDepth)) { AppendPathInformation = true }; 157throw new ArgumentException(SR.Format(SR.CannotSerializeInvalidType, typeToConvert), paramName); 170throw new InvalidOperationException(SR.Format(SR.CannotSerializeInvalidType, typeToConvert)); 216throw new InvalidOperationException(SR.Format(SR.SerializationConverterOnAttributeInvalid, location)); 363throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_NameSpan, Truncate(name))); 370throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_NameSpan, Truncate(name))); 391throw new InvalidOperationException(SR.Format(SR.NamingPolicyReturnNull, namingPolicy)); 397throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsNull, converterType)); 403throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsJsonConverterFactory, converterType)); 425throw new InvalidOperationException(SR.Format(SR.ConstructorParamIncompleteBinding, parentType)); 469SR.Format(SR.ObjectWithParameterizedCtorRefMetadataNotSupported, jsonTypeInfo.Type)); 476throw new InvalidOperationException(SR.Format(SR.InvalidJsonTypeInfoOperationForKind, kind)); 482throw new InvalidOperationException(SR.Format(SR.OnDeserializingCallbacksNotSupported, type)); 488throw new InvalidOperationException(SR.Format(SR.CreateObjectConverterNotCompatible, type)); 546message = SR.Format(SR.DeserializeUnableToConvertValue, propertyType); 621throw new InvalidOperationException(SR.Format(SR.PropertyTypeNotNullable, jsonPropertyInfo.PropertyType)); 648message += SR.Format(SR.SerializationNotSupportedParentType, propertyType); 676message += SR.Format(SR.SerializationNotSupportedParentType, propertyType); 694message = SR.Format(SR.DeserializationMustSpecifyTypeDiscriminator, type); 698message = SR.Format(SR.CannotPopulateCollection, type); 702message = SR.Format(SR.DeserializeInterfaceOrAbstractType, type); 716ThrowNotSupportedException(ref state, reader, new NotSupportedException(SR.Format(SR.CannotPopulateCollection, type))); 722ThrowJsonException(SR.Format(SR.MetadataInvalidTokenAfterValues, tokenType)); 728ThrowJsonException(SR.Format(SR.MetadataReferenceNotFound, id)); 734ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, tokenType)); 740ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, valueKind)); 802ThrowJsonException(SR.Format(SR.MetadataDuplicateIdFound, id)); 808ThrowJsonException(SR.Format(SR.DuplicateMetadataProperty, Encoding.UTF8.GetString(utf8PropertyName))); 814ThrowJsonException(SR.Format(SR.MetadataInvalidReferenceToValueType, propertyType)); 824SR.Format(SR.MetadataInvalidPropertyInArrayMetadata, propertyNameAsString), 825SR.Format(SR.DeserializeUnableToConvertValue, propertyType))); 836SR.Format(SR.DeserializeUnableToConvertValue, propertyType))); 842ThrowJsonException(SR.Format(SR.MetadataCannotParsePreservedObjectToImmutable, propertyType)); 890throw new NotSupportedException(SR.Format(SR.ConstructorContainsNullParameterNames, declaringType)); 913throw new MissingMemberException(SR.Format(SR.MissingFSharpCoreMember, missingFsharpCoreMember)); 919throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedType)); 925throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedType)); 943throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDoesNotSupportPolymorphism, baseType)); 979throw new InvalidOperationException(SR.Format(SR.Polymorphism_InferClosedTypePolymorphismOnNonClosedType, baseType)); 997throw new InvalidOperationException(SR.Format(SR.Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes, baseType)); 1003ThrowJsonException(SR.Format(SR.UnionDoesNotAcceptNull, unionType)); 1015ThrowJsonException(SR.Format(SR.UnionCannotCreateValue, unionType)); 1021ThrowJsonException(SR.Format(SR.UnionCannotReadValue, unionType)); 1045throw new InvalidOperationException(SR.Format(SR.UnionCasesNotPopulated, unionType)); 1051throw new InvalidOperationException(SR.Format(SR.UnionCannotCreateValue, unionType)); 1057throw new InvalidOperationException(SR.Format(SR.UnionCannotReadValue, unionType)); 1063throw new InvalidOperationException(SR.Format(SR.UnionTypeStructuralClassifierOnlyForUnions, unionType)); 1082SR.Format( 1138ThrowJsonException(SR.Format(SR.Polymorphism_UnrecognizedTypeDiscriminator, typeDiscriminator)); 1162throw new InvalidOperationException(SR.Format(SR.PipeWriter_DoesNotImplementUnflushedBytes, pipeWriter.GetType().Name));
System\Text\Json\Writer\JsonWriterHelper.cs (2)
234SR.Format(SR.ExpectedEndOfDigitNotFound, ThrowHelper.GetPrintableString(val)), 251SR.Format(SR.ExpectedEndOfDigitNotFound, ThrowHelper.GetPrintableString(utf8FormattedNumber[i])),