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