105 references to Format
System.Text.Json (105)
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)
198throw 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\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)); 240return GetInvalidOperationException(SR.Format(SR.ZeroDepthAtEnd, currentDepth)); 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); 728message = 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 (45)
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)); 329throw new InvalidOperationException(SR.Format(SR.NamingPolicyReturnNull, namingPolicy)); 335throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsNull, converterType)); 341throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsJsonConverterFactory, converterType)); 363throw new InvalidOperationException(SR.Format(SR.ConstructorParamIncompleteBinding, parentType)); 407SR.Format(SR.ObjectWithParameterizedCtorRefMetadataNotSupported, jsonTypeInfo.Type)); 414throw new InvalidOperationException(SR.Format(SR.InvalidJsonTypeInfoOperationForKind, kind)); 420throw new InvalidOperationException(SR.Format(SR.OnDeserializingCallbacksNotSupported, type)); 426throw new InvalidOperationException(SR.Format(SR.CreateObjectConverterNotCompatible, type)); 482message = SR.Format(SR.DeserializeUnableToConvertValue, propertyType); 557throw new InvalidOperationException(SR.Format(SR.PropertyTypeNotNullable, jsonPropertyInfo.PropertyType)); 584message += SR.Format(SR.SerializationNotSupportedParentType, propertyType); 612message += SR.Format(SR.SerializationNotSupportedParentType, propertyType); 630message = SR.Format(SR.DeserializationMustSpecifyTypeDiscriminator, type); 634message = SR.Format(SR.CannotPopulateCollection, type); 638message = SR.Format(SR.DeserializeInterfaceOrAbstractType, type); 652ThrowNotSupportedException(ref state, reader, new NotSupportedException(SR.Format(SR.CannotPopulateCollection, type))); 658ThrowJsonException(SR.Format(SR.MetadataInvalidTokenAfterValues, tokenType)); 664ThrowJsonException(SR.Format(SR.MetadataReferenceNotFound, id)); 670ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, tokenType)); 676ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, valueKind)); 738ThrowJsonException(SR.Format(SR.MetadataDuplicateIdFound, id)); 744ThrowJsonException(SR.Format(SR.DuplicateMetadataProperty, JsonHelpers.Utf8GetString(utf8PropertyName))); 750ThrowJsonException(SR.Format(SR.MetadataInvalidReferenceToValueType, propertyType)); 760SR.Format(SR.MetadataInvalidPropertyInArrayMetadata, propertyNameAsString), 761SR.Format(SR.DeserializeUnableToConvertValue, propertyType))); 772SR.Format(SR.DeserializeUnableToConvertValue, propertyType))); 778ThrowJsonException(SR.Format(SR.MetadataCannotParsePreservedObjectToImmutable, propertyType)); 826throw new NotSupportedException(SR.Format(SR.ConstructorContainsNullParameterNames, declaringType)); 849throw new MissingMemberException(SR.Format(SR.MissingFSharpCoreMember, missingFsharpCoreMember)); 855throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedType)); 861throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedType)); 879throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDoesNotSupportPolymorphism, baseType)); 915throw new InvalidOperationException(SR.Format(SR.Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes, baseType)); 927ThrowJsonException(SR.Format(SR.Polymorphism_UnrecognizedTypeDiscriminator, typeDiscriminator)); 945throw 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])),