< Summary

Line coverage
1%
Covered lines: 11
Uncovered lines: 826
Coverable lines: 837
Total lines: 2079
Line coverage: 1.3%
Branch coverage
2%
Covered branches: 5
Total branches: 192
Branch coverage: 2.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
File 1: ThrowArgumentNullException(...)100%110%
File 2: ThrowArgumentOutOfRangeException_NewLine(...)100%110%
File 2: ThrowArgumentOutOfRangeException_IndentCharacter(...)100%110%
File 2: ThrowArgumentOutOfRangeException_IndentSize(...)100%110%
File 2: ThrowArgumentOutOfRangeException_MaxDepthMustBePositive(...)100%110%
File 2: ThrowArgumentOutOfRangeException_JsonNumberExponentTooLarge(...)100%110%
File 2: GetArgumentOutOfRangeException(...)100%110%
File 2: ThrowArgumentOutOfRangeException_CommentEnumMustBeInRange(...)100%110%
File 2: ThrowArgumentOutOfRangeException_JsonConverterFactory_TypeNotSupported(...)100%110%
File 2: ThrowArgumentOutOfRangeException_NeedNonNegNum(...)100%110%
File 2: ThrowArgumentException_InvalidOffLen()100%110%
File 2: GetArgumentException(...)100%110%
File 2: ThrowArgumentException(...)100%110%
File 2: ThrowArgumentException_DestinationTooShort()100%110%
File 2: ThrowArgumentException_PropertyNameTooLarge(...)100%110%
File 2: ThrowArgumentException_ValueTooLarge(...)100%110%
File 2: ThrowArgumentException_ValueNotSupported()100%110%
File 2: ThrowInvalidOperationException_NeedLargerSpan()100%110%
File 2: ThrowPropertyNameTooLargeArgumentException(...)100%110%
File 2: ThrowArgumentException(...)0%220%
File 2: ThrowArgumentException(...)0%220%
File 2: ThrowArgumentException(...)0%220%
File 2: ThrowArgumentException(...)0%220%
File 2: ThrowInvalidOperationOrArgumentException(...)0%220%
File 2: ThrowInvalidOperationException(...)100%110%
File 2: ThrowInvalidOperationException(...)100%110%
File 2: GetInvalidOperationException(...)100%11100%
File 2: ThrowInvalidOperationOrArgumentException(...)0%220%
File 2: GetInvalidOperationException_ExpectedArray(...)100%110%
File 2: GetInvalidOperationException_ExpectedObject(...)100%110%
File 2: ThrowInvalidOperationException_ExpectedNumber(...)100%110%
File 2: ThrowInvalidOperationException_ExpectedBoolean(...)100%110%
File 2: ThrowInvalidOperationException_ExpectedString(...)100%110%
File 2: ThrowInvalidOperationException_ExpectedPropertyName(...)100%110%
File 2: ThrowInvalidOperationException_ExpectedStringComparison(...)100%110%
File 2: ThrowInvalidOperationException_ExpectedComment(...)100%110%
File 2: ThrowInvalidOperationException_CannotSkipOnPartial()100%110%
File 2: ThrowInvalidOperationException_CannotMixEncodings(...)100%11100%
File 2: GetEncodingName(System.Text.Json.Utf8JsonWriter/EnclosingContainerType)83.33%6685.71%
File 2: GetInvalidOperationException(...)100%110%
File 2: GetInvalidOperationException(...)100%110%
File 2: ThrowJsonElementWrongTypeException(...)100%110%
File 2: GetJsonElementWrongTypeException(...)100%110%
File 2: GetJsonElementWrongTypeException(...)100%110%
File 2: ThrowJsonReaderException(...)100%110%
File 2: GetJsonReaderException(...)100%110%
File 2: IsPrintable(...)0%220%
File 2: GetPrintableString(...)0%220%
File 2: GetResourceString(...)0%42420%
File 2: ThrowInvalidOperationException(...)100%110%
File 2: ThrowArgumentException_InvalidCommentValue()100%110%
File 2: ThrowArgumentException_InvalidUTF8(...)0%660%
File 2: ThrowArgumentException_InvalidUTF16(...)100%110%
File 2: ThrowInvalidOperationException_ReadInvalidUTF16(...)100%110%
File 2: ThrowInvalidOperationException_ReadIncompleteUTF16()100%110%
File 2: GetInvalidOperationException_ReadInvalidUTF8(...)100%110%
File 2: GetArgumentException_ReadInvalidUTF16(...)100%110%
File 2: GetInvalidOperationException(...)100%110%
File 2: GetInvalidOperationException(...)100%110%
File 2: ThrowOutOfMemoryException(...)100%110%
File 2: GetResourceString(...)0%18180%
File 2: ThrowFormatException()100%110%
File 2: ThrowFormatException(...)100%110%
File 2: ThrowFormatException(...)0%10100%
File 2: ThrowInvalidOperationException_ExpectedChar(...)100%110%
File 2: ThrowObjectDisposedException_Utf8JsonWriter()100%110%
File 2: ThrowObjectDisposedException_JsonDocument()100%110%
File 2: ThrowInsufficientExecutionStackException_JsonElementDeepEqualsInsufficientExecutionStack()100%110%
File 3: ThrowArgumentException_NodeValueNotAllowed(...)100%110%
File 3: ThrowInvalidOperationException_NodeAlreadyHasParent()100%110%
File 3: ThrowInvalidOperationException_NodeCycleDetected()100%110%
File 3: ThrowInvalidOperationException_NodeElementCannotBeObjectOrArray()100%110%
File 3: ThrowInvalidOperationException_NodeWrongType(...)0%220%
File 3: ThrowInvalidOperationException_NodeParentWrongType(...)100%110%
File 3: ThrowInvalidOperationException_NodeUnableToConvert(...)100%110%
File 3: ThrowInvalidOperationException_NodeUnableToConvertElement(...)100%110%
File 4: ThrowArgumentException_DeserializeWrongType(...)100%110%
File 4: ThrowArgumentException_SerializerDoesNotSupportComments(...)100%110%
File 4: ThrowNotSupportedException_SerializationNotSupported(...)100%110%
File 4: ThrowNotSupportedException_TypeRequiresAsyncSerialization(...)100%110%
File 4: ThrowNotSupportedException_DictionaryKeyTypeNotSupported(...)100%110%
File 4: ThrowJsonException_DeserializeUnableToConvertValue(...)100%110%
File 4: ThrowInvalidCastException_DeserializeUnableToAssignValue(...)100%110%
File 4: ThrowInvalidOperationException_DeserializeUnableToAssignNull(...)100%110%
File 4: ThrowJsonException_PropertyGetterDisallowNull(...)100%110%
File 4: ThrowJsonException_PropertySetterDisallowNull(...)100%110%
File 4: ThrowJsonException_ConstructorParameterDisallowNull(...)100%110%
File 4: ThrowInvalidOperationException_ObjectCreationHandlingPopulateNotSupportedByConverter(...)100%110%
File 4: ThrowInvalidOperationException_ObjectCreationHandlingPropertyMustHaveAGetter(...)100%110%
File 4: ThrowInvalidOperationException_ObjectCreationHandlingPropertyValueTypeMustHaveASetter(...)100%110%
File 4: ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowPolymorphicDeserialization(...)100%110%
File 4: ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReadOnlyMember(...)100%110%
File 4: ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReferenceHandling()100%110%
File 4: ThrowNotSupportedException_ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors()100%110%
File 4: ThrowJsonException_SerializationConverterRead(...)100%110%
File 4: ThrowJsonException_SerializationConverterWrite(...)100%110%
File 4: ThrowJsonException_SerializerCycleDetected(...)100%110%
File 4: ThrowJsonException(...)100%110%
File 4: ThrowArgumentException_CannotSerializeInvalidType(...)0%220%
File 4: ThrowInvalidOperationException_CannotSerializeInvalidType(...)0%220%
File 4: ThrowInvalidOperationException_SerializationConverterNotCompatible(...)100%110%
File 4: ThrowInvalidOperationException_ResolverTypeNotCompatible(...)100%110%
File 4: ThrowInvalidOperationException_ResolverTypeInfoOptionsNotCompatible()100%110%
File 4: ThrowInvalidOperationException_JsonSerializerOptionsNoTypeInfoResolverSpecified()100%110%
File 4: ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled()100%110%
File 4: ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(...)0%220%
File 4: ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(...)0%220%
File 4: ThrowInvalidOperationException_SerializationConverterOnAttributeOpenGenericNotCompatible(...)0%220%
File 4: ThrowInvalidOperationException_SerializerOptionsReadOnly(...)0%220%
File 4: ThrowInvalidOperationException_DefaultTypeInfoResolverImmutable()100%110%
File 4: ThrowInvalidOperationException_TypeInfoResolverChainImmutable()100%110%
File 4: ThrowInvalidOperationException_TypeInfoImmutable()100%110%
File 4: ThrowInvalidOperationException_InvalidChainedResolver()100%110%
File 4: ThrowInvalidOperationException_SerializerPropertyNameConflict(...)100%110%
File 4: ThrowInvalidOperationException_SerializerPropertyNameNull(...)100%110%
File 4: ThrowInvalidOperationException_JsonPropertyRequiredAndNotDeserializable(...)100%110%
File 4: ThrowInvalidOperationException_JsonPropertyRequiredAndExtensionData(...)100%110%
File 4: ThrowJsonException_JsonRequiredPropertyMissing(...)0%660%
File 4: ThrowJsonException_JsonRequiredPropertyMissing(...)100%110%
File 4: AppendMissingProperty(...)0%220%
File 4: ThrowJsonException_DuplicatePropertyNotAllowed(...)100%110%
File 4: ThrowJsonException_DuplicatePropertyNotAllowed()100%110%
File 4: ThrowJsonException_DuplicatePropertyNotAllowed(...)100%110%
File 4: ThrowJsonException_DuplicatePropertyNotAllowed(...)100%110%
File 4: Truncate(...)0%220%
File 4: ThrowInvalidOperationException_NamingPolicyReturnNull(...)100%110%
File 4: ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(...)100%110%
File 4: ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactory(...)100%110%
File 4: ThrowInvalidOperationException_MultiplePropertiesBindToConstructorParameters(...)100%110%
File 4: ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(...)100%110%
File 4: ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(...)100%110%
File 4: ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(...)100%110%
File 4: ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(...)100%110%
File 4: ThrowInvalidOperationException_NumberHandlingOnPropertyInvalid(...)100%110%
File 4: ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(...)100%110%
File 4: ThrowNotSupportedException_ObjectWithParameterizedCtorRefMetadataNotSupported(...)100%110%
File 4: ThrowInvalidOperationException_JsonTypeInfoOperationNotPossibleForKind(...)100%110%
File 4: ThrowInvalidOperationException_JsonTypeInfoOnDeserializingCallbacksNotSupported(...)100%110%
File 4: ThrowInvalidOperationException_CreateObjectConverterNotCompatible(...)100%110%
File 4: ReThrowWithPath(...)0%220%
File 4: ReThrowWithPath(...)100%110%
File 4: AddJsonExceptionInformation(...)0%14140%
File 4: ReThrowWithPath(...)100%110%
File 4: AddJsonExceptionInformation(...)0%440%
File 4: ThrowInvalidOperationException_SerializationDuplicateAttribute(...)0%220%
File 4: ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(...)100%110%
File 4: ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(...)100%110%
File 4: ThrowInvalidOperationException_ExtensionDataConflictsWithUnmappedMemberHandling(...)100%110%
File 4: ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(...)100%110%
File 4: ThrowInvalidOperationException_PropertyTypeNotNullable(...)100%110%
File 4: ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty()100%110%
File 4: ThrowNotSupportedException(...)0%880%
File 4: ThrowNotSupportedException(...)0%880%
File 4: ThrowNotSupportedException_DeserializeNoConstructor(...)0%14140%
File 4: ThrowNotSupportedException_CannotPopulateCollection(...)100%110%
File 4: ThrowJsonException_MetadataValuesInvalidToken(...)100%110%
File 4: ThrowJsonException_MetadataReferenceNotFound(...)100%110%
File 4: ThrowJsonException_MetadataValueWasNotString(...)100%110%
File 4: ThrowJsonException_MetadataValueWasNotString(...)100%110%
File 4: ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties(...)100%110%
File 4: ThrowJsonException_MetadataUnexpectedProperty(...)100%110%
File 4: ThrowJsonException_UnmappedJsonProperty(...)100%110%
File 4: ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties()100%110%
File 4: ThrowJsonException_MetadataIdCannotBeCombinedWithRef(...)100%110%
File 4: ThrowJsonException_MetadataStandaloneValuesProperty(...)100%110%
File 4: ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(...)0%220%
File 4: ThrowJsonException_MetadataDuplicateIdFound(...)100%110%
File 4: ThrowJsonException_DuplicateMetadataProperty(...)100%110%
File 4: ThrowJsonException_MetadataInvalidReferenceToValueType(...)100%110%
File 4: ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(...)0%220%
File 4: ThrowJsonException_MetadataPreservedArrayValuesNotFound(...)100%110%
File 4: ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(...)100%110%
File 4: ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(...)100%110%
File 4: ThrowInvalidOperationException_JsonPropertyInfoIsBoundToDifferentJsonTypeInfo(...)100%110%
File 4: ThrowUnexpectedMetadataException(...)0%220%
File 4: ThrowNotSupportedException_NoMetadataForType(...)0%440%
File 4: GetNotSupportedException_AmbiguousMetadataForType(...)100%110%
File 4: ThrowNotSupportedException_ConstructorContainsNullParameterNames(...)100%110%
File 4: ThrowInvalidOperationException_NoMetadataForType(...)0%440%
File 4: GetInvalidOperationException_NoMetadataForTypeProperties(...)0%440%
File 4: ThrowInvalidOperationException_NoMetadataForTypeProperties(...)100%110%
File 4: ThrowMissingMemberException_MissingFSharpCoreMember(...)100%110%
File 4: ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(...)100%110%
File 4: ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(...)100%110%
File 4: ThrowNotSupportedException_RuntimeTypeNotSupported(...)100%110%
File 4: ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(...)100%110%
File 4: ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(...)100%110%
File 4: ThrowInvalidOperationException_DerivedTypeNotSupported(...)100%110%
File 4: ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(...)100%110%
File 4: ThrowInvalidOperationException_OpenGenericDerivedTypeCouldNotBeResolved(...)100%110%
File 4: ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(...)100%110%
File 4: ThrowInvalidOperationException_InferredDerivedTypeIsNotAccessible(...)100%110%
File 4: ThrowInvalidOperationException_InferClosedTypePolymorphismOnNonClosedType(...)100%110%
File 4: ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName()100%110%
File 4: ThrowInvalidOperationException_PropertyConflictsWithMetadataPropertyName(...)100%110%
File 4: ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(...)100%110%
File 4: ThrowJsonException_UnionDoesNotAcceptNull(...)100%110%
File 4: ThrowJsonException_UnionRuntimeTypeNotMatchedToCase(...)100%110%
File 4: ThrowJsonException_UnionCannotCreateValue(...)100%110%
File 4: ThrowJsonException_UnionCannotReadValue(...)100%110%
File 4: ThrowJsonException_UnionTypeClassifierReturnedNull(...)100%110%
File 4: ThrowJsonException_UnionAmbiguousJsonValueType(...)100%110%
File 4: ThrowJsonException_UnionJsonTokenTypeNotSupported(...)100%110%
File 4: ThrowInvalidOperationException_UnionCasesNotPopulated(...)100%110%
File 4: ThrowInvalidOperationException_UnionCannotCreateValue(...)100%110%
File 4: ThrowInvalidOperationException_UnionCannotReadValue(...)100%110%
File 4: ThrowInvalidOperationException_UnionTypeStructuralClassifierOnlyForUnions(...)100%110%
File 4: ThrowNotSupportedException_UnionTypeStructuralClassifierCaseNotSupported(...)100%110%
File 4: ThrowNotSupportedException_UnionTypeStructuralClassifierPreserveReferencesNotSupported(...)100%110%
File 4: ThrowNotSupportedException_UnionTypeStructuralClassifierAmbiguousCases(...)100%110%
File 4: ThrowNotSupportedException_UnionTypeStructuralClassifierUnreachableObjectCase(...)100%110%
File 4: ThrowInvalidOperationException_TypeClassifierMustDeriveFromJsonTypeClassifierFactory(...)100%110%
File 4: ThrowInvalidOperationException_TypeClassifierNotSupported(...)100%110%
File 4: ThrowInvalidOperationException_UnsupportedEnumIdentifier(...)100%110%
File 4: ThrowJsonException_UnrecognizedTypeDiscriminator(...)100%110%
File 4: ThrowArgumentException_JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo(...)100%110%
File 4: ThrowOperationCanceledException_PipeWriteCanceled()100%110%
File 4: ThrowOperationCanceledException_PipeReadCanceled()100%110%
File 4: ThrowInvalidOperationException_PipeWriterDoesNotImplementUnflushedBytes(...)100%110%
File 4: ThrowNotSupportedException_JsonSchemaExporterDoesNotSupportReferenceHandlerPreserve()100%110%
File 4: ThrowInvalidOperationException_JsonSchemaExporterDepthTooLarge()100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/Common/ThrowHelper.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Diagnostics.CodeAnalysis;
 5
 6namespace System.Text.Json
 7{
 8    internal static partial class ThrowHelper
 9    {
 10        [DoesNotReturn]
 11        public static void ThrowArgumentNullException(string parameterName)
 012        {
 013            throw new ArgumentNullException(parameterName);
 14        }
 15    }
 16}
 17

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Diagnostics;
 5using System.Diagnostics.CodeAnalysis;
 6using System.Runtime.CompilerServices;
 7using static System.Text.Json.Utf8JsonWriter;
 8
 9namespace System.Text.Json
 10{
 11    internal static partial class ThrowHelper
 12    {
 13        // If the exception source is this value, the serializer will re-throw as JsonException.
 14        public const string ExceptionSourceValueToRethrowAsJsonException = "System.Text.Json.Rethrowable";
 15
 16        [DoesNotReturn]
 17        public static void ThrowArgumentOutOfRangeException_NewLine(string parameterName)
 018        {
 019            throw GetArgumentOutOfRangeException(parameterName, SR.InvalidNewLine);
 20        }
 21
 22        [DoesNotReturn]
 23        public static void ThrowArgumentOutOfRangeException_IndentCharacter(string parameterName)
 024        {
 025            throw GetArgumentOutOfRangeException(parameterName, SR.InvalidIndentCharacter);
 26        }
 27
 28        [DoesNotReturn]
 29        public static void ThrowArgumentOutOfRangeException_IndentSize(string parameterName, int minimumSize, int maximu
 030        {
 031            throw GetArgumentOutOfRangeException(parameterName, SR.Format(SR.InvalidIndentSize, minimumSize, maximumSize
 32        }
 33
 34        [DoesNotReturn]
 35        public static void ThrowArgumentOutOfRangeException_MaxDepthMustBePositive(string parameterName)
 036        {
 037            throw GetArgumentOutOfRangeException(parameterName, SR.MaxDepthMustBePositive);
 38        }
 39
 40        [DoesNotReturn]
 41        public static void ThrowArgumentOutOfRangeException_JsonNumberExponentTooLarge(string parameterName)
 042        {
 043            throw GetArgumentOutOfRangeException(parameterName, SR.JsonNumberExponentTooLarge);
 44        }
 45
 46        private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(string parameterName, string message)
 047        {
 048            return new ArgumentOutOfRangeException(parameterName, message);
 049        }
 50
 51        [DoesNotReturn]
 52        public static void ThrowArgumentOutOfRangeException_CommentEnumMustBeInRange(string parameterName)
 053        {
 054            throw GetArgumentOutOfRangeException(parameterName, SR.CommentHandlingMustBeValid);
 55        }
 56
 57        [DoesNotReturn]
 58        public static void ThrowArgumentOutOfRangeException_ArrayIndexNegative(string paramName)
 59        {
 60            throw new ArgumentOutOfRangeException(paramName, SR.ArrayIndexNegative);
 61        }
 62
 63        [DoesNotReturn]
 64        public static void ThrowArgumentOutOfRangeException_JsonConverterFactory_TypeNotSupported(Type typeToConvert)
 065        {
 066            throw new ArgumentOutOfRangeException(nameof(typeToConvert), SR.Format(SR.SerializerConverterFactoryInvalidA
 67        }
 68
 69        [DoesNotReturn]
 70        public static void ThrowArgumentOutOfRangeException_NeedNonNegNum(string paramName)
 071        {
 072            throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_Generic_MustBeNonNegative);
 73        }
 74
 75        [DoesNotReturn]
 76        public static void ThrowArgumentException_InvalidOffLen()
 077        {
 078            throw new ArgumentException(SR.Argument_InvalidOffLen);
 79        }
 80
 81        [DoesNotReturn]
 82        public static void ThrowArgumentException_ArrayTooSmall(string paramName)
 83        {
 84            throw new ArgumentException(SR.ArrayTooSmall, paramName);
 85        }
 86
 87        private static ArgumentException GetArgumentException(string message)
 088        {
 089            return new ArgumentException(message);
 090        }
 91
 92        [DoesNotReturn]
 93        public static void ThrowArgumentException(string message)
 094        {
 095            throw GetArgumentException(message);
 96        }
 97
 98        public static InvalidOperationException GetInvalidOperationException_CallFlushFirst(int _buffered)
 99        {
 100            return GetInvalidOperationException(SR.Format(SR.CallFlushToAvoidDataLoss, _buffered));
 101        }
 102
 103        [DoesNotReturn]
 104        public static void ThrowArgumentException_DestinationTooShort()
 0105        {
 0106            throw GetArgumentException(SR.DestinationTooShort);
 107        }
 108
 109        [DoesNotReturn]
 110        public static void ThrowArgumentException_PropertyNameTooLarge(int tokenLength)
 0111        {
 0112            throw GetArgumentException(SR.Format(SR.PropertyNameTooLarge, tokenLength));
 113        }
 114
 115        [DoesNotReturn]
 116        public static void ThrowArgumentException_ValueTooLarge(long tokenLength)
 0117        {
 0118            throw GetArgumentException(SR.Format(SR.ValueTooLarge, tokenLength));
 119        }
 120
 121        [DoesNotReturn]
 122        public static void ThrowArgumentException_ValueNotSupported()
 0123        {
 0124            throw GetArgumentException(SR.SpecialNumberValuesNotSupported);
 125        }
 126
 127        [DoesNotReturn]
 128        public static void ThrowInvalidOperationException_NeedLargerSpan()
 0129        {
 0130            throw GetInvalidOperationException(SR.FailedToGetLargerSpan);
 131        }
 132
 133        [DoesNotReturn]
 134        public static void ThrowPropertyNameTooLargeArgumentException(int length)
 0135        {
 0136            throw GetArgumentException(SR.Format(SR.PropertyNameTooLarge, length));
 137        }
 138
 139        [DoesNotReturn]
 140        public static void ThrowArgumentException(ReadOnlySpan<byte> propertyName, ReadOnlySpan<byte> value)
 0141        {
 0142            if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize)
 0143            {
 0144                ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
 145            }
 146            else
 0147            {
 0148                Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize);
 0149                ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
 150            }
 151        }
 152
 153        [DoesNotReturn]
 154        public static void ThrowArgumentException(ReadOnlySpan<byte> propertyName, ReadOnlySpan<char> value)
 0155        {
 0156            if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize)
 0157            {
 0158                ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
 159            }
 160            else
 0161            {
 0162                Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize);
 0163                ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
 164            }
 165        }
 166
 167        [DoesNotReturn]
 168        public static void ThrowArgumentException(ReadOnlySpan<char> propertyName, ReadOnlySpan<byte> value)
 0169        {
 0170            if (propertyName.Length > JsonConstants.MaxCharacterTokenSize)
 0171            {
 0172                ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
 173            }
 174            else
 0175            {
 0176                Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize);
 0177                ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
 178            }
 179        }
 180
 181        [DoesNotReturn]
 182        public static void ThrowArgumentException(ReadOnlySpan<char> propertyName, ReadOnlySpan<char> value)
 0183        {
 0184            if (propertyName.Length > JsonConstants.MaxCharacterTokenSize)
 0185            {
 0186                ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
 187            }
 188            else
 0189            {
 0190                Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize);
 0191                ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
 192            }
 193        }
 194
 195        [DoesNotReturn]
 196        public static void ThrowInvalidOperationOrArgumentException(ReadOnlySpan<byte> propertyName, int currentDepth, i
 0197        {
 0198            currentDepth &= JsonConstants.RemoveFlagsBitMask;
 0199            if (currentDepth >= maxDepth)
 0200            {
 0201                ThrowInvalidOperationException(SR.Format(SR.DepthTooLarge, currentDepth, maxDepth));
 202            }
 203            else
 0204            {
 0205                Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize);
 0206                ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
 207            }
 208        }
 209
 210        [DoesNotReturn]
 211        public static void ThrowInvalidOperationException(int currentDepth, int maxDepth)
 0212        {
 0213            currentDepth &= JsonConstants.RemoveFlagsBitMask;
 0214            Debug.Assert(currentDepth >= maxDepth);
 0215            ThrowInvalidOperationException(SR.Format(SR.DepthTooLarge, currentDepth, maxDepth));
 216        }
 217
 218        [DoesNotReturn]
 219        public static void ThrowInvalidOperationException(string message)
 0220        {
 0221            throw GetInvalidOperationException(message);
 222        }
 223
 224        private static InvalidOperationException GetInvalidOperationException(string message)
 1248225        {
 1248226            return new InvalidOperationException(message) { Source = ExceptionSourceValueToRethrowAsJsonException };
 1248227        }
 228
 229        [DoesNotReturn]
 230        public static void ThrowInvalidOperationException_DepthNonZeroOrEmptyJson(int currentDepth)
 231        {
 232            throw GetInvalidOperationException(currentDepth);
 233        }
 234
 235        private static InvalidOperationException GetInvalidOperationException(int currentDepth)
 236        {
 237            currentDepth &= JsonConstants.RemoveFlagsBitMask;
 238            if (currentDepth != 0)
 239            {
 240                return GetInvalidOperationException(SR.ZeroDepthAtEnd);
 241            }
 242            else
 243            {
 244                return GetInvalidOperationException(SR.EmptyJsonIsInvalid);
 245            }
 246        }
 247
 248        [DoesNotReturn]
 249        public static void ThrowInvalidOperationOrArgumentException(ReadOnlySpan<char> propertyName, int currentDepth, i
 0250        {
 0251            currentDepth &= JsonConstants.RemoveFlagsBitMask;
 0252            if (currentDepth >= maxDepth)
 0253            {
 0254                ThrowInvalidOperationException(SR.Format(SR.DepthTooLarge, currentDepth, maxDepth));
 255            }
 256            else
 0257            {
 0258                Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize);
 0259                ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
 260            }
 261        }
 262
 263        public static InvalidOperationException GetInvalidOperationException_ExpectedArray(JsonTokenType tokenType)
 0264        {
 0265            return GetInvalidOperationException("array", tokenType);
 0266        }
 267
 268        public static InvalidOperationException GetInvalidOperationException_ExpectedObject(JsonTokenType tokenType)
 0269        {
 0270            return GetInvalidOperationException("object", tokenType);
 0271        }
 272
 273        [DoesNotReturn]
 274        public static void ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
 0275        {
 0276            throw GetInvalidOperationException("number", tokenType);
 277        }
 278
 279        [DoesNotReturn]
 280        public static void ThrowInvalidOperationException_ExpectedBoolean(JsonTokenType tokenType)
 0281        {
 0282            throw GetInvalidOperationException("boolean", tokenType);
 283        }
 284
 285        [DoesNotReturn]
 286        public static void ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
 0287        {
 0288            throw GetInvalidOperationException("string", tokenType);
 289        }
 290
 291        [DoesNotReturn]
 292        public static void ThrowInvalidOperationException_ExpectedPropertyName(JsonTokenType tokenType)
 0293        {
 0294            throw GetInvalidOperationException("propertyName", tokenType);
 295        }
 296
 297        [DoesNotReturn]
 298        public static void ThrowInvalidOperationException_ExpectedStringComparison(JsonTokenType tokenType)
 0299        {
 0300            throw GetInvalidOperationException(tokenType);
 301        }
 302
 303        [DoesNotReturn]
 304        public static void ThrowInvalidOperationException_ExpectedComment(JsonTokenType tokenType)
 0305        {
 0306            throw GetInvalidOperationException("comment", tokenType);
 307        }
 308
 309        [DoesNotReturn]
 310        public static void ThrowInvalidOperationException_CannotSkipOnPartial()
 0311        {
 0312            throw GetInvalidOperationException(SR.CannotSkip);
 313        }
 314
 315        [DoesNotReturn]
 316        [MethodImpl(MethodImplOptions.NoInlining)]
 317        public static void ThrowInvalidOperationException_CannotMixEncodings(EnclosingContainerType previousEncoding, En
 1248318        {
 1248319            throw GetInvalidOperationException(SR.Format(SR.CannotMixEncodings, GetEncodingName(previousEncoding), GetEn
 320
 321            static string GetEncodingName(EnclosingContainerType encoding)
 2496322            {
 2496323                switch (encoding)
 324                {
 832325                    case EnclosingContainerType.Utf8StringSequence: return "UTF-8";
 832326                    case EnclosingContainerType.Utf16StringSequence: return "UTF-16";
 832327                    case EnclosingContainerType.Base64StringSequence: return "Base64";
 328                    default:
 0329                        Debug.Fail("Unknown encoding.");
 330                        return "Unknown";
 331                };
 2496332            }
 333        }
 334
 335        private static InvalidOperationException GetInvalidOperationException(string message, JsonTokenType tokenType)
 0336        {
 0337            return GetInvalidOperationException(SR.Format(SR.InvalidCast, tokenType, message));
 0338        }
 339
 340        private static InvalidOperationException GetInvalidOperationException(JsonTokenType tokenType)
 0341        {
 0342            return GetInvalidOperationException(SR.Format(SR.InvalidComparison, tokenType));
 0343        }
 344
 345        [DoesNotReturn]
 346        internal static void ThrowJsonElementWrongTypeException(
 347            JsonTokenType expectedType,
 348            JsonTokenType actualType)
 0349        {
 0350            throw GetJsonElementWrongTypeException(expectedType.ToValueKind(), actualType.ToValueKind());
 351        }
 352
 353        internal static InvalidOperationException GetJsonElementWrongTypeException(
 354            JsonValueKind expectedType,
 355            JsonValueKind actualType)
 0356        {
 0357            return GetInvalidOperationException(
 0358                SR.Format(SR.JsonElementHasWrongType, expectedType, actualType));
 0359        }
 360
 361        internal static InvalidOperationException GetJsonElementWrongTypeException(
 362            string expectedTypeName,
 363            JsonValueKind actualType)
 0364        {
 0365            return GetInvalidOperationException(
 0366                SR.Format(SR.JsonElementHasWrongType, expectedTypeName, actualType));
 0367        }
 368
 369        [DoesNotReturn]
 370        public static void ThrowJsonReaderException(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte =
 0371        {
 0372            throw GetJsonReaderException(ref json, resource, nextByte, bytes);
 373        }
 374
 375        [MethodImpl(MethodImplOptions.NoInlining)]
 376        public static JsonException GetJsonReaderException(ref Utf8JsonReader json, ExceptionResource resource, byte nex
 0377        {
 0378            string message = GetResourceString(ref json, resource, nextByte, Encoding.UTF8.GetString(bytes));
 379
 0380            long lineNumber = json.CurrentState._lineNumber;
 0381            long bytePositionInLine = json.CurrentState._bytePositionInLine;
 382
 0383            message += $" LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
 0384            return new JsonReaderException(message, lineNumber, bytePositionInLine);
 0385        }
 386
 0387        private static bool IsPrintable(byte value) => value is >= 0x20 and < 0x7F;
 388
 389        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 390        internal static string GetPrintableString(byte value)
 0391        {
 0392            return IsPrintable(value) ? ((char)value).ToString() : $"0x{value:X2}";
 0393        }
 394
 395        // This function will convert an ExceptionResource enum value to the resource string.
 396        [MethodImpl(MethodImplOptions.NoInlining)]
 397        private static string GetResourceString(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte, stri
 0398        {
 0399            string character = GetPrintableString(nextByte);
 400
 0401            string message = "";
 0402            switch (resource)
 403            {
 404                case ExceptionResource.ArrayDepthTooLarge:
 0405                    message = SR.Format(SR.ArrayDepthTooLarge, json.CurrentState.Options.MaxDepth);
 0406                    break;
 407                case ExceptionResource.MismatchedObjectArray:
 0408                    message = SR.Format(SR.MismatchedObjectArray, character);
 0409                    break;
 410                case ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd:
 0411                    message = SR.TrailingCommaNotAllowedBeforeArrayEnd;
 0412                    break;
 413                case ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd:
 0414                    message = SR.TrailingCommaNotAllowedBeforeObjectEnd;
 0415                    break;
 416                case ExceptionResource.EndOfStringNotFound:
 0417                    message = SR.EndOfStringNotFound;
 0418                    break;
 419                case ExceptionResource.RequiredDigitNotFoundAfterSign:
 0420                    message = SR.Format(SR.RequiredDigitNotFoundAfterSign, character);
 0421                    break;
 422                case ExceptionResource.RequiredDigitNotFoundAfterDecimal:
 0423                    message = SR.Format(SR.RequiredDigitNotFoundAfterDecimal, character);
 0424                    break;
 425                case ExceptionResource.RequiredDigitNotFoundEndOfData:
 0426                    message = SR.RequiredDigitNotFoundEndOfData;
 0427                    break;
 428                case ExceptionResource.ExpectedEndAfterSingleJson:
 0429                    message = SR.Format(SR.ExpectedEndAfterSingleJson, character);
 0430                    break;
 431                case ExceptionResource.ExpectedEndOfDigitNotFound:
 0432                    message = SR.Format(SR.ExpectedEndOfDigitNotFound, character);
 0433                    break;
 434                case ExceptionResource.ExpectedNextDigitEValueNotFound:
 0435                    message = SR.Format(SR.ExpectedNextDigitEValueNotFound, character);
 0436                    break;
 437                case ExceptionResource.ExpectedSeparatorAfterPropertyNameNotFound:
 0438                    message = SR.Format(SR.ExpectedSeparatorAfterPropertyNameNotFound, character);
 0439                    break;
 440                case ExceptionResource.ExpectedStartOfPropertyNotFound:
 0441                    message = SR.Format(SR.ExpectedStartOfPropertyNotFound, character);
 0442                    break;
 443                case ExceptionResource.ExpectedStartOfPropertyOrValueNotFound:
 0444                    message = SR.ExpectedStartOfPropertyOrValueNotFound;
 0445                    break;
 446                case ExceptionResource.ExpectedStartOfPropertyOrValueAfterComment:
 0447                    message = SR.Format(SR.ExpectedStartOfPropertyOrValueAfterComment, character);
 0448                    break;
 449                case ExceptionResource.ExpectedStartOfValueNotFound:
 0450                    message = SR.Format(SR.ExpectedStartOfValueNotFound, character);
 0451                    break;
 452                case ExceptionResource.ExpectedValueAfterPropertyNameNotFound:
 0453                    message = SR.ExpectedValueAfterPropertyNameNotFound;
 0454                    break;
 455                case ExceptionResource.FoundInvalidCharacter:
 0456                    message = SR.Format(SR.FoundInvalidCharacter, character);
 0457                    break;
 458                case ExceptionResource.InvalidEndOfJsonNonPrimitive:
 0459                    message = SR.Format(SR.InvalidEndOfJsonNonPrimitive, json.TokenType);
 0460                    break;
 461                case ExceptionResource.ObjectDepthTooLarge:
 0462                    message = SR.Format(SR.ObjectDepthTooLarge, json.CurrentState.Options.MaxDepth);
 0463                    break;
 464                case ExceptionResource.ExpectedFalse:
 0465                    message = SR.Format(SR.ExpectedFalse, characters);
 0466                    break;
 467                case ExceptionResource.ExpectedNull:
 0468                    message = SR.Format(SR.ExpectedNull, characters);
 0469                    break;
 470                case ExceptionResource.ExpectedTrue:
 0471                    message = SR.Format(SR.ExpectedTrue, characters);
 0472                    break;
 473                case ExceptionResource.InvalidCharacterWithinString:
 0474                    message = SR.Format(SR.InvalidCharacterWithinString, character);
 0475                    break;
 476                case ExceptionResource.InvalidCharacterAfterEscapeWithinString:
 0477                    message = SR.Format(SR.InvalidCharacterAfterEscapeWithinString, character);
 0478                    break;
 479                case ExceptionResource.InvalidHexCharacterWithinString:
 0480                    message = SR.Format(SR.InvalidHexCharacterWithinString, character);
 0481                    break;
 482                case ExceptionResource.EndOfCommentNotFound:
 0483                    message = SR.EndOfCommentNotFound;
 0484                    break;
 485                case ExceptionResource.ZeroDepthAtEnd:
 0486                    message = SR.ZeroDepthAtEnd;
 0487                    break;
 488                case ExceptionResource.ExpectedJsonTokens:
 0489                    message = SR.ExpectedJsonTokens;
 0490                    break;
 491                case ExceptionResource.NotEnoughData:
 0492                    message = SR.NotEnoughData;
 0493                    break;
 494                case ExceptionResource.ExpectedOneCompleteToken:
 0495                    message = SR.ExpectedOneCompleteToken;
 0496                    break;
 497                case ExceptionResource.InvalidCharacterAtStartOfComment:
 0498                    message = SR.Format(SR.InvalidCharacterAtStartOfComment, character);
 0499                    break;
 500                case ExceptionResource.UnexpectedEndOfDataWhileReadingComment:
 0501                    message = SR.UnexpectedEndOfDataWhileReadingComment;
 0502                    break;
 503                case ExceptionResource.UnexpectedEndOfLineSeparator:
 0504                    message = SR.UnexpectedEndOfLineSeparator;
 0505                    break;
 506                case ExceptionResource.InvalidLeadingZeroInNumber:
 0507                    message = SR.Format(SR.InvalidLeadingZeroInNumber, character);
 0508                    break;
 509                default:
 0510                    Debug.Fail($"The ExceptionResource enum value: {resource} is not part of the switch. Add the appropr
 511                    break;
 512            }
 513
 0514            return message;
 0515        }
 516
 517        [DoesNotReturn]
 518        public static void ThrowInvalidOperationException(ExceptionResource resource, int currentDepth, int maxDepth, by
 0519        {
 0520            throw GetInvalidOperationException(resource, currentDepth, maxDepth, token, tokenType);
 521        }
 522
 523        [DoesNotReturn]
 524        public static void ThrowArgumentException_InvalidCommentValue()
 0525        {
 0526            throw new ArgumentException(SR.CannotWriteCommentWithEmbeddedDelimiter);
 527        }
 528
 529        [DoesNotReturn]
 530        public static void ThrowArgumentException_InvalidUTF8(ReadOnlySpan<byte> value)
 0531        {
 0532            var builder = new StringBuilder();
 533
 0534            int printFirst10 = Math.Min(value.Length, 10);
 535
 0536            for (int i = 0; i < printFirst10; i++)
 0537            {
 0538                byte nextByte = value[i];
 0539                if (IsPrintable(nextByte))
 0540                {
 0541                    builder.Append((char)nextByte);
 0542                }
 543                else
 0544                {
 0545                    builder.Append($"0x{nextByte:X2}");
 0546                }
 0547            }
 548
 0549            if (printFirst10 < value.Length)
 0550            {
 0551                builder.Append("...");
 0552            }
 553
 0554            throw new ArgumentException(SR.Format(SR.CannotEncodeInvalidUTF8, builder));
 555        }
 556
 557        [DoesNotReturn]
 558        public static void ThrowArgumentException_InvalidUTF16(int charAsInt)
 0559        {
 0560            throw new ArgumentException(SR.Format(SR.CannotEncodeInvalidUTF16, $"0x{charAsInt:X2}"));
 561        }
 562
 563        [DoesNotReturn]
 564        public static void ThrowInvalidOperationException_ReadInvalidUTF16(int charAsInt)
 0565        {
 0566            throw GetInvalidOperationException(SR.Format(SR.CannotReadInvalidUTF16, $"0x{charAsInt:X2}"));
 567        }
 568
 569        [DoesNotReturn]
 570        public static void ThrowInvalidOperationException_ReadIncompleteUTF16()
 0571        {
 0572            throw GetInvalidOperationException(SR.CannotReadIncompleteUTF16);
 573        }
 574
 575        public static InvalidOperationException GetInvalidOperationException_ReadInvalidUTF8(DecoderFallbackException? i
 0576        {
 0577            return GetInvalidOperationException(SR.CannotTranscodeInvalidUtf8, innerException);
 0578        }
 579
 580        public static ArgumentException GetArgumentException_ReadInvalidUTF16(EncoderFallbackException innerException)
 0581        {
 0582            return new ArgumentException(SR.CannotTranscodeInvalidUtf16, innerException);
 0583        }
 584
 585        public static InvalidOperationException GetInvalidOperationException(string message, Exception? innerException)
 0586        {
 0587            InvalidOperationException ex = new InvalidOperationException(message, innerException);
 0588            ex.Source = ExceptionSourceValueToRethrowAsJsonException;
 0589            return ex;
 0590        }
 591
 592        [MethodImpl(MethodImplOptions.NoInlining)]
 593        public static InvalidOperationException GetInvalidOperationException(ExceptionResource resource, int currentDept
 0594        {
 0595            string message = GetResourceString(resource, currentDepth, maxDepth, token, tokenType);
 0596            InvalidOperationException ex = GetInvalidOperationException(message);
 0597            ex.Source = ExceptionSourceValueToRethrowAsJsonException;
 0598            return ex;
 0599        }
 600
 601        [DoesNotReturn]
 602        public static void ThrowOutOfMemoryException(uint capacity)
 0603        {
 0604            throw new OutOfMemoryException(SR.Format(SR.BufferMaximumSizeExceeded, capacity));
 605        }
 606
 607        // This function will convert an ExceptionResource enum value to the resource string.
 608        [MethodImpl(MethodImplOptions.NoInlining)]
 609        private static string GetResourceString(ExceptionResource resource, int currentDepth, int maxDepth, byte token, 
 0610        {
 0611            string message = "";
 0612            switch (resource)
 613            {
 614                case ExceptionResource.MismatchedObjectArray:
 0615                    Debug.Assert(token is JsonConstants.CloseBracket or JsonConstants.CloseBrace);
 0616                    message = (tokenType == JsonTokenType.PropertyName) ?
 0617                        SR.Format(SR.CannotWriteEndAfterProperty, (char)token) :
 0618                        SR.Format(SR.MismatchedObjectArray, (char)token);
 0619                    break;
 620                case ExceptionResource.DepthTooLarge:
 0621                    message = SR.Format(SR.DepthTooLarge, currentDepth & JsonConstants.RemoveFlagsBitMask, maxDepth);
 0622                    break;
 623                case ExceptionResource.CannotStartObjectArrayWithoutProperty:
 0624                    message = SR.Format(SR.CannotStartObjectArrayWithoutProperty, tokenType);
 0625                    break;
 626                case ExceptionResource.CannotStartObjectArrayAfterPrimitiveOrClose:
 0627                    message = SR.Format(SR.CannotStartObjectArrayAfterPrimitiveOrClose, tokenType);
 0628                    break;
 629                case ExceptionResource.CannotWriteValueWithinObject:
 0630                    message = SR.Format(SR.CannotWriteValueWithinObject, tokenType);
 0631                    break;
 632                case ExceptionResource.CannotWritePropertyWithinArray:
 0633                    message = (tokenType == JsonTokenType.PropertyName) ?
 0634                        SR.CannotWritePropertyAfterProperty :
 0635                        SR.Format(SR.CannotWritePropertyWithinArray, tokenType);
 0636                    break;
 637                case ExceptionResource.CannotWriteValueAfterPrimitiveOrClose:
 0638                    message = SR.Format(SR.CannotWriteValueAfterPrimitiveOrClose, tokenType);
 0639                    break;
 640                case ExceptionResource.CannotWriteWithinString:
 0641                    message = SR.CannotWriteWithinString;
 0642                    break;
 643                default:
 0644                    Debug.Fail($"The ExceptionResource enum value: {resource} is not part of the switch. Add the appropr
 645                    break;
 646            }
 647
 0648            return message;
 0649        }
 650
 651        [DoesNotReturn]
 652        public static void ThrowFormatException()
 0653        {
 0654            throw new FormatException { Source = ExceptionSourceValueToRethrowAsJsonException };
 655        }
 656
 657        [DoesNotReturn]
 658        public static void ThrowFormatException(NumericType numericType)
 0659        {
 0660            throw new FormatException(SR.Format(SR.FormatNumericType, numericType)) { Source = ExceptionSourceValueToRet
 661        }
 662
 663        [DoesNotReturn]
 664        public static void ThrowFormatException(DataType dataType)
 0665        {
 0666            string message = "";
 667
 0668            switch (dataType)
 669            {
 670                case DataType.Boolean:
 671                case DataType.DateOnly:
 672                case DataType.DateTime:
 673                case DataType.DateTimeOffset:
 674                case DataType.TimeOnly:
 675                case DataType.TimeSpan:
 676                case DataType.Guid:
 677                case DataType.Version:
 0678                    message = SR.Format(SR.UnsupportedFormat, dataType);
 0679                    break;
 680                case DataType.Base64String:
 0681                    message = SR.CannotDecodeInvalidBase64;
 0682                    break;
 683                default:
 0684                    Debug.Fail($"The DataType enum value: {dataType} is not part of the switch. Add the appropriate case
 685                    break;
 686            }
 687
 0688            throw new FormatException(message) { Source = ExceptionSourceValueToRethrowAsJsonException };
 689        }
 690
 691        [DoesNotReturn]
 692        public static void ThrowInvalidOperationException_ExpectedChar(JsonTokenType tokenType)
 0693        {
 0694            throw GetInvalidOperationException("char", tokenType);
 695        }
 696
 697        [DoesNotReturn]
 698        public static void ThrowObjectDisposedException_Utf8JsonWriter()
 0699        {
 0700            throw new ObjectDisposedException(nameof(Utf8JsonWriter));
 701        }
 702
 703        [DoesNotReturn]
 704        public static void ThrowObjectDisposedException_JsonDocument()
 0705        {
 0706            throw new ObjectDisposedException(nameof(JsonDocument));
 707        }
 708
 709        [DoesNotReturn]
 710        public static void ThrowInsufficientExecutionStackException_JsonElementDeepEqualsInsufficientExecutionStack()
 0711        {
 0712            throw new InsufficientExecutionStackException(SR.JsonElementDeepEqualsInsufficientExecutionStack);
 713        }
 714    }
 715
 716    internal enum ExceptionResource
 717    {
 718        ArrayDepthTooLarge,
 719        EndOfCommentNotFound,
 720        EndOfStringNotFound,
 721        RequiredDigitNotFoundAfterDecimal,
 722        RequiredDigitNotFoundAfterSign,
 723        RequiredDigitNotFoundEndOfData,
 724        ExpectedEndAfterSingleJson,
 725        ExpectedEndOfDigitNotFound,
 726        ExpectedFalse,
 727        ExpectedNextDigitEValueNotFound,
 728        ExpectedNull,
 729        ExpectedSeparatorAfterPropertyNameNotFound,
 730        ExpectedStartOfPropertyNotFound,
 731        ExpectedStartOfPropertyOrValueNotFound,
 732        ExpectedStartOfPropertyOrValueAfterComment,
 733        ExpectedStartOfValueNotFound,
 734        ExpectedTrue,
 735        ExpectedValueAfterPropertyNameNotFound,
 736        FoundInvalidCharacter,
 737        InvalidCharacterWithinString,
 738        InvalidCharacterAfterEscapeWithinString,
 739        InvalidHexCharacterWithinString,
 740        InvalidEndOfJsonNonPrimitive,
 741        MismatchedObjectArray,
 742        ObjectDepthTooLarge,
 743        ZeroDepthAtEnd,
 744        DepthTooLarge,
 745        CannotStartObjectArrayWithoutProperty,
 746        CannotStartObjectArrayAfterPrimitiveOrClose,
 747        CannotWriteValueWithinObject,
 748        CannotWriteValueAfterPrimitiveOrClose,
 749        CannotWritePropertyWithinArray,
 750        ExpectedJsonTokens,
 751        TrailingCommaNotAllowedBeforeArrayEnd,
 752        TrailingCommaNotAllowedBeforeObjectEnd,
 753        InvalidCharacterAtStartOfComment,
 754        UnexpectedEndOfDataWhileReadingComment,
 755        UnexpectedEndOfLineSeparator,
 756        ExpectedOneCompleteToken,
 757        NotEnoughData,
 758        InvalidLeadingZeroInNumber,
 759        CannotWriteWithinString,
 760    }
 761
 762    internal enum NumericType
 763    {
 764        Byte,
 765        SByte,
 766        Int16,
 767        Int32,
 768        Int64,
 769        Int128,
 770        UInt16,
 771        UInt32,
 772        UInt64,
 773        UInt128,
 774        Half,
 775        Single,
 776        Double,
 777        Decimal,
 778        BFloat16,
 779        Decimal32,
 780        Decimal64,
 781        Decimal128
 782    }
 783
 784    internal enum DataType
 785    {
 786        Boolean,
 787        DateOnly,
 788        DateTime,
 789        DateTimeOffset,
 790        TimeOnly,
 791        TimeSpan,
 792        Base64String,
 793        Guid,
 794        Version,
 795    }
 796}
 797

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Node.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Collections.Generic;
 5using System.Diagnostics;
 6using System.Diagnostics.CodeAnalysis;
 7using System.Runtime.CompilerServices;
 8
 9namespace System.Text.Json
 10{
 11    internal static partial class ThrowHelper
 12    {
 13        [DoesNotReturn]
 14        public static void ThrowArgumentException_NodeValueNotAllowed(string paramName)
 015        {
 016            throw new ArgumentException(SR.NodeValueNotAllowed, paramName);
 17        }
 18
 19        [DoesNotReturn]
 20        public static void ThrowArgumentException_DuplicateKey(string paramName, object? propertyName)
 21        {
 22            throw new ArgumentException(SR.Format(SR.NodeDuplicateKey, propertyName), paramName);
 23        }
 24
 25        [DoesNotReturn]
 26        public static void ThrowKeyNotFoundException()
 27        {
 28            throw new KeyNotFoundException();
 29        }
 30
 31        [DoesNotReturn]
 32        public static void ThrowInvalidOperationException_NodeAlreadyHasParent()
 033        {
 034            throw new InvalidOperationException(SR.NodeAlreadyHasParent);
 35        }
 36
 37        [DoesNotReturn]
 38        public static void ThrowInvalidOperationException_NodeCycleDetected()
 039        {
 040            throw new InvalidOperationException(SR.NodeCycleDetected);
 41        }
 42
 43        [DoesNotReturn]
 44        public static void ThrowInvalidOperationException_NodeElementCannotBeObjectOrArray()
 045        {
 046            throw new InvalidOperationException(SR.NodeElementCannotBeObjectOrArray);
 47        }
 48
 49        [DoesNotReturn]
 50        public static void ThrowNotSupportedException_CollectionIsReadOnly()
 51        {
 52            throw GetNotSupportedException_CollectionIsReadOnly();
 53        }
 54
 55        [DoesNotReturn]
 56        public static void ThrowInvalidOperationException_NodeWrongType(params ReadOnlySpan<string> supportedTypeNames)
 057        {
 058            Debug.Assert(supportedTypeNames.Length > 0);
 059            string concatenatedNames = supportedTypeNames.Length == 1 ? supportedTypeNames[0] : string.Join(", ", suppor
 060            throw new InvalidOperationException(SR.Format(SR.NodeWrongType, concatenatedNames));
 61        }
 62
 63        [DoesNotReturn]
 64        public static void ThrowInvalidOperationException_NodeParentWrongType(string typeName)
 065        {
 066            throw new InvalidOperationException(SR.Format(SR.NodeParentWrongType, typeName));
 67        }
 68
 69        public static NotSupportedException GetNotSupportedException_CollectionIsReadOnly()
 70        {
 71            return new NotSupportedException(SR.CollectionIsReadOnly);
 72        }
 73
 74        [DoesNotReturn]
 75        public static void ThrowInvalidOperationException_NodeUnableToConvert(Type sourceType, Type destinationType)
 076        {
 077            throw new InvalidOperationException(SR.Format(SR.NodeUnableToConvert, sourceType, destinationType));
 78        }
 79
 80        [DoesNotReturn]
 81        public static void ThrowInvalidOperationException_NodeUnableToConvertElement(JsonValueKind valueKind, Type desti
 082        {
 083            throw new InvalidOperationException(SR.Format(SR.NodeUnableToConvertElement, valueKind, destinationType));
 84        }
 85    }
 86}
 87

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Buffers;
 5using System.Collections;
 6using System.Collections.Generic;
 7using System.Diagnostics;
 8using System.Diagnostics.CodeAnalysis;
 9using System.Globalization;
 10using System.IO.Pipelines;
 11using System.Reflection;
 12using System.Text.Json.Serialization;
 13using System.Text.Json.Serialization.Metadata;
 14
 15namespace System.Text.Json
 16{
 17    internal static partial class ThrowHelper
 18    {
 19        [DoesNotReturn]
 20        public static void ThrowArgumentException_DeserializeWrongType(Type type, object value)
 021        {
 022            throw new ArgumentException(SR.Format(SR.DeserializeWrongType, type, value.GetType()));
 23        }
 24
 25        [DoesNotReturn]
 26        public static void ThrowArgumentException_SerializerDoesNotSupportComments(string paramName)
 027        {
 028            throw new ArgumentException(SR.JsonSerializerDoesNotSupportComments, paramName);
 29        }
 30
 31        [DoesNotReturn]
 32        public static void ThrowNotSupportedException_SerializationNotSupported(Type propertyType)
 033        {
 034            throw new NotSupportedException(SR.Format(SR.SerializationNotSupportedType, propertyType));
 35        }
 36
 37        [DoesNotReturn]
 38        public static void ThrowNotSupportedException_TypeRequiresAsyncSerialization(Type propertyType)
 039        {
 040            throw new NotSupportedException(SR.Format(SR.TypeRequiresAsyncSerialization, propertyType));
 41        }
 42
 43        [DoesNotReturn]
 44        public static void ThrowNotSupportedException_DictionaryKeyTypeNotSupported(Type keyType, JsonConverter converte
 045        {
 046            throw new NotSupportedException(SR.Format(SR.DictionaryKeyTypeNotSupported, keyType, converter.GetType()));
 47        }
 48
 49        [DoesNotReturn]
 50        public static void ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
 051        {
 052            throw new JsonException(SR.Format(SR.DeserializeUnableToConvertValue, propertyType)) { AppendPathInformation
 53        }
 54
 55        [DoesNotReturn]
 56        public static void ThrowInvalidCastException_DeserializeUnableToAssignValue(Type typeOfValue, Type declaredType)
 057        {
 058            throw new InvalidCastException(SR.Format(SR.DeserializeUnableToAssignValue, typeOfValue, declaredType));
 59        }
 60
 61        [DoesNotReturn]
 62        public static void ThrowInvalidOperationException_DeserializeUnableToAssignNull(Type declaredType)
 063        {
 064            throw new InvalidOperationException(SR.Format(SR.DeserializeUnableToAssignNull, declaredType));
 65        }
 66
 67        [DoesNotReturn]
 68        public static void ThrowJsonException_PropertyGetterDisallowNull(string propertyName, Type declaringType)
 069        {
 070            throw new JsonException(SR.Format(SR.PropertyGetterDisallowNull, propertyName, declaringType)) { AppendPathI
 71        }
 72
 73        [DoesNotReturn]
 74        public static void ThrowJsonException_PropertySetterDisallowNull(string propertyName, Type declaringType)
 075        {
 076            throw new JsonException(SR.Format(SR.PropertySetterDisallowNull, propertyName, declaringType)) { AppendPathI
 77        }
 78
 79        [DoesNotReturn]
 80        public static void ThrowJsonException_ConstructorParameterDisallowNull(string parameterName, Type declaringType)
 081        {
 082            throw new JsonException(SR.Format(SR.ConstructorParameterDisallowNull, parameterName, declaringType)) { Appe
 83        }
 84
 85        [DoesNotReturn]
 86        public static void ThrowInvalidOperationException_ObjectCreationHandlingPopulateNotSupportedByConverter(JsonProp
 087        {
 088            throw new InvalidOperationException(SR.Format(SR.ObjectCreationHandlingPopulateNotSupportedByConverter, prop
 89        }
 90
 91        [DoesNotReturn]
 92        public static void ThrowInvalidOperationException_ObjectCreationHandlingPropertyMustHaveAGetter(JsonPropertyInfo
 093        {
 094            throw new InvalidOperationException(SR.Format(SR.ObjectCreationHandlingPropertyMustHaveAGetter, propertyInfo
 95        }
 96
 97        [DoesNotReturn]
 98        public static void ThrowInvalidOperationException_ObjectCreationHandlingPropertyValueTypeMustHaveASetter(JsonPro
 099        {
 0100            throw new InvalidOperationException(SR.Format(SR.ObjectCreationHandlingPropertyValueTypeMustHaveASetter, pro
 101        }
 102
 103        [DoesNotReturn]
 104        public static void ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowPolymorphicDeserializ
 0105        {
 0106            throw new InvalidOperationException(SR.Format(SR.ObjectCreationHandlingPropertyCannotAllowPolymorphicDeseria
 107        }
 108
 109        [DoesNotReturn]
 110        public static void ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReadOnlyMember(JsonPr
 0111        {
 0112            throw new InvalidOperationException(SR.Format(SR.ObjectCreationHandlingPropertyCannotAllowReadOnlyMember, pr
 113        }
 114
 115        [DoesNotReturn]
 116        public static void ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReferenceHandling()
 0117        {
 0118            throw new InvalidOperationException(SR.ObjectCreationHandlingPropertyCannotAllowReferenceHandling);
 119        }
 120
 121        [DoesNotReturn]
 122        public static void ThrowNotSupportedException_ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstruct
 0123        {
 0124            throw new NotSupportedException(SR.ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors);
 125        }
 126
 127        [DoesNotReturn]
 128        public static void ThrowJsonException_SerializationConverterRead(JsonConverter? converter)
 0129        {
 0130            throw new JsonException(SR.Format(SR.SerializationConverterRead, converter)) { AppendPathInformation = true 
 131        }
 132
 133        [DoesNotReturn]
 134        public static void ThrowJsonException_SerializationConverterWrite(JsonConverter? converter)
 0135        {
 0136            throw new JsonException(SR.Format(SR.SerializationConverterWrite, converter)) { AppendPathInformation = true
 137        }
 138
 139        [DoesNotReturn]
 140        public static void ThrowJsonException_SerializerCycleDetected(int maxDepth)
 0141        {
 0142            throw new JsonException(SR.Format(SR.SerializerCycleDetected, maxDepth)) { AppendPathInformation = true };
 143        }
 144
 145        [DoesNotReturn]
 146        public static void ThrowJsonException(string? message = null)
 0147        {
 0148            throw new JsonException(message) { AppendPathInformation = true };
 149        }
 150
 151        [DoesNotReturn]
 152        public static void ThrowArgumentException_CannotSerializeInvalidType(string paramName, Type typeToConvert, Type?
 0153        {
 0154            if (declaringType == null)
 0155            {
 0156                Debug.Assert(propertyName is null);
 0157                throw new ArgumentException(SR.Format(SR.CannotSerializeInvalidType, typeToConvert), paramName);
 158            }
 159
 0160            Debug.Assert(propertyName is not null);
 0161            throw new ArgumentException(SR.Format(SR.CannotSerializeInvalidMember, typeToConvert, propertyName, declarin
 162        }
 163
 164        [DoesNotReturn]
 165        public static void ThrowInvalidOperationException_CannotSerializeInvalidType(Type typeToConvert, Type? declaring
 0166        {
 0167            if (declaringType == null)
 0168            {
 0169                Debug.Assert(memberInfo == null);
 0170                throw new InvalidOperationException(SR.Format(SR.CannotSerializeInvalidType, typeToConvert));
 171            }
 172
 0173            Debug.Assert(memberInfo != null);
 0174            throw new InvalidOperationException(SR.Format(SR.CannotSerializeInvalidMember, typeToConvert, memberInfo.Nam
 175        }
 176
 177        [DoesNotReturn]
 178        public static void ThrowInvalidOperationException_SerializationConverterNotCompatible(Type converterType, Type t
 0179        {
 0180            throw new InvalidOperationException(SR.Format(SR.SerializationConverterNotCompatible, converterType, type));
 181        }
 182
 183        [DoesNotReturn]
 184        public static void ThrowInvalidOperationException_ResolverTypeNotCompatible(Type requestedType, Type actualType)
 0185        {
 0186            throw new InvalidOperationException(SR.Format(SR.ResolverTypeNotCompatible, actualType, requestedType));
 187        }
 188
 189        [DoesNotReturn]
 190        public static void ThrowInvalidOperationException_ResolverTypeInfoOptionsNotCompatible()
 0191        {
 0192            throw new InvalidOperationException(SR.ResolverTypeInfoOptionsNotCompatible);
 193        }
 194
 195        [DoesNotReturn]
 196        public static void ThrowInvalidOperationException_JsonSerializerOptionsNoTypeInfoResolverSpecified()
 0197        {
 0198            throw new InvalidOperationException(SR.JsonSerializerOptionsNoTypeInfoResolverSpecified);
 199        }
 200
 201        [DoesNotReturn]
 202        public static void ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled()
 0203        {
 0204            throw new InvalidOperationException(SR.JsonSerializerIsReflectionDisabled);
 205        }
 206
 207        [DoesNotReturn]
 208        public static void ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(Type classType, Membe
 0209        {
 0210            string location = classType.ToString();
 0211            if (memberInfo != null)
 0212            {
 0213                location += $".{memberInfo.Name}";
 0214            }
 215
 0216            throw new InvalidOperationException(SR.Format(SR.SerializationConverterOnAttributeInvalid, location));
 217        }
 218
 219        [DoesNotReturn]
 220        public static void ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(Type classTypeA
 0221        {
 0222            string location = classTypeAttributeIsOn.ToString();
 223
 0224            if (memberInfo != null)
 0225            {
 0226                location += $".{memberInfo.Name}";
 0227            }
 228
 0229            throw new InvalidOperationException(SR.Format(SR.SerializationConverterOnAttributeNotCompatible, location, t
 230        }
 231
 232        [DoesNotReturn]
 233        public static void ThrowInvalidOperationException_SerializationConverterOnAttributeOpenGenericNotCompatible(Type
 0234        {
 0235            string location = classType.ToString();
 0236            if (memberInfo != null)
 0237            {
 0238                location += $".{memberInfo.Name}";
 0239            }
 240
 0241            throw new InvalidOperationException(SR.Format(SR.SerializationConverterOnAttributeOpenGenericNotCompatible, 
 242        }
 243
 244        [DoesNotReturn]
 245        public static void ThrowInvalidOperationException_SerializerOptionsReadOnly(JsonSerializerContext? context)
 0246        {
 0247            string message = context is null
 0248                ? SR.SerializerOptionsReadOnly
 0249                : SR.SerializerContextOptionsReadOnly;
 250
 0251            throw new InvalidOperationException(message);
 252        }
 253
 254        [DoesNotReturn]
 255        public static void ThrowInvalidOperationException_DefaultTypeInfoResolverImmutable()
 0256        {
 0257            throw new InvalidOperationException(SR.DefaultTypeInfoResolverImmutable);
 258        }
 259
 260        [DoesNotReturn]
 261        public static void ThrowInvalidOperationException_TypeInfoResolverChainImmutable()
 0262        {
 0263            throw new InvalidOperationException(SR.TypeInfoResolverChainImmutable);
 264        }
 265
 266        [DoesNotReturn]
 267        public static void ThrowInvalidOperationException_TypeInfoImmutable()
 0268        {
 0269            throw new InvalidOperationException(SR.TypeInfoImmutable);
 270        }
 271
 272        [DoesNotReturn]
 273        public static void ThrowInvalidOperationException_InvalidChainedResolver()
 0274        {
 0275            throw new InvalidOperationException(SR.SerializerOptions_InvalidChainedResolver);
 276        }
 277
 278        [DoesNotReturn]
 279        public static void ThrowInvalidOperationException_SerializerPropertyNameConflict(Type type, string propertyName)
 0280        {
 0281            throw new InvalidOperationException(SR.Format(SR.SerializerPropertyNameConflict, type, propertyName));
 282        }
 283
 284        [DoesNotReturn]
 285        public static void ThrowInvalidOperationException_SerializerPropertyNameNull(JsonPropertyInfo jsonPropertyInfo)
 0286        {
 0287            throw new InvalidOperationException(SR.Format(SR.SerializerPropertyNameNull, jsonPropertyInfo.DeclaringType,
 288        }
 289
 290        [DoesNotReturn]
 291        public static void ThrowInvalidOperationException_JsonPropertyRequiredAndNotDeserializable(JsonPropertyInfo json
 0292        {
 0293            throw new InvalidOperationException(SR.Format(SR.JsonPropertyRequiredAndNotDeserializable, jsonPropertyInfo.
 294        }
 295
 296        [DoesNotReturn]
 297        public static void ThrowInvalidOperationException_JsonPropertyRequiredAndExtensionData(JsonPropertyInfo jsonProp
 0298        {
 0299            throw new InvalidOperationException(SR.Format(SR.JsonPropertyRequiredAndExtensionData, jsonPropertyInfo.Name
 300        }
 301
 302        [DoesNotReturn]
 303        public static void ThrowJsonException_JsonRequiredPropertyMissing(JsonTypeInfo parent, BitArray assignedOrNotReq
 0304        {
 0305            StringBuilder builder = new();
 306
 0307            foreach (JsonPropertyInfo property in parent.PropertyCache)
 0308            {
 0309                if (!assignedOrNotRequiredPropertiesSet[property.PropertyIndex])
 0310                {
 0311                    if (!AppendMissingProperty(builder, property.Name))
 0312                    {
 0313                        break;
 314                    }
 0315                }
 0316            }
 317
 0318            throw new JsonException(SR.Format(SR.JsonRequiredPropertiesMissing, parent.Type, builder.ToString()));
 319        }
 320
 321        [DoesNotReturn]
 322        public static void ThrowJsonException_JsonRequiredPropertyMissing(Type type, string propertyList)
 0323        {
 0324            throw new JsonException(SR.Format(SR.JsonRequiredPropertiesMissing, type, propertyList));
 325        }
 326
 327        /// <summary>
 328        /// Appends a property name to a missing-properties list with culture-aware separators and a soft length cut-off
 329        /// Returns false when the cut-off is reached and no more names should be appended.
 330        /// </summary>
 331        internal static bool AppendMissingProperty(StringBuilder builder, string propertyName)
 0332        {
 333            const int CutOffLength = 60;
 334
 0335            if (builder.Length > 0)
 0336            {
 0337                builder.Append(CultureInfo.CurrentUICulture.TextInfo.ListSeparator);
 0338                builder.Append(' ');
 0339            }
 340
 0341            builder.Append('\'');
 0342            builder.Append(propertyName);
 0343            builder.Append('\'');
 344
 0345            return builder.Length < CutOffLength;
 0346        }
 347
 348        [DoesNotReturn]
 349        public static void ThrowJsonException_DuplicatePropertyNotAllowed(JsonPropertyInfo property)
 0350        {
 0351            throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_JsonPropertyInfo, property.Name, property
 352        }
 353
 354        [DoesNotReturn]
 355        public static void ThrowJsonException_DuplicatePropertyNotAllowed()
 0356        {
 0357            throw new JsonException(SR.DuplicatePropertiesNotAllowed);
 358        }
 359
 360        [DoesNotReturn]
 361        public static void ThrowJsonException_DuplicatePropertyNotAllowed(string name)
 0362        {
 0363            throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_NameSpan, Truncate(name)));
 364        }
 365
 366        [DoesNotReturn]
 367        public static void ThrowJsonException_DuplicatePropertyNotAllowed(ReadOnlySpan<byte> nameBytes)
 0368        {
 0369            string name = Encoding.UTF8.GetString(nameBytes);
 0370            throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_NameSpan, Truncate(name)));
 371        }
 372
 373        private static unsafe string Truncate(ReadOnlySpan<char> str)
 0374        {
 375            const int MaxLength = 15;
 376
 0377            if (str.Length <= MaxLength)
 0378            {
 0379                return str.ToString();
 380            }
 381
 0382            Span<char> builder = stackalloc char[MaxLength + 3];
 0383            str.Slice(0, MaxLength).CopyTo(builder);
 0384            builder[MaxLength] = builder[MaxLength + 1] = builder[MaxLength + 2] = '.';
 0385            return builder.ToString();
 0386        }
 387
 388        [DoesNotReturn]
 389        public static void ThrowInvalidOperationException_NamingPolicyReturnNull(JsonNamingPolicy namingPolicy)
 0390        {
 0391            throw new InvalidOperationException(SR.Format(SR.NamingPolicyReturnNull, namingPolicy));
 392        }
 393
 394        [DoesNotReturn]
 395        public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(Type converterType)
 0396        {
 0397            throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsNull, converterType));
 398        }
 399
 400        [DoesNotReturn]
 401        public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactory(Type con
 0402        {
 0403            throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsJsonConverterFactory, conv
 404        }
 405
 406        [DoesNotReturn]
 407        public static void ThrowInvalidOperationException_MultiplePropertiesBindToConstructorParameters(
 408            Type parentType,
 409            string parameterName,
 410            string firstMatchName,
 411            string secondMatchName)
 0412        {
 0413            throw new InvalidOperationException(
 0414                SR.Format(
 0415                    SR.MultipleMembersBindWithConstructorParameter,
 0416                    firstMatchName,
 0417                    secondMatchName,
 0418                    parentType,
 0419                    parameterName));
 420        }
 421
 422        [DoesNotReturn]
 423        public static void ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
 0424        {
 0425            throw new InvalidOperationException(SR.Format(SR.ConstructorParamIncompleteBinding, parentType));
 426        }
 427
 428        [DoesNotReturn]
 429        public static void ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(string propertyName, JsonPr
 0430        {
 0431            throw new InvalidOperationException(SR.Format(SR.ExtensionDataCannotBindToCtorParam, propertyName, jsonPrope
 432        }
 433
 434        [DoesNotReturn]
 435        public static void ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(string memberName, Type decl
 0436        {
 0437            throw new InvalidOperationException(SR.Format(SR.JsonIncludeOnInaccessibleProperty, memberName, declaringTyp
 438        }
 439
 440        [DoesNotReturn]
 441        public static void ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(string clrPropertyName, Type
 0442        {
 0443            throw new InvalidOperationException(SR.Format(SR.IgnoreConditionOnValueTypeInvalid, clrPropertyName, propert
 444        }
 445
 446        [DoesNotReturn]
 447        public static void ThrowInvalidOperationException_NumberHandlingOnPropertyInvalid(JsonPropertyInfo jsonPropertyI
 0448        {
 0449            Debug.Assert(!jsonPropertyInfo.IsForTypeInfo);
 0450            throw new InvalidOperationException(SR.Format(SR.NumberHandlingOnPropertyInvalid, jsonPropertyInfo.MemberNam
 451        }
 452
 453        [DoesNotReturn]
 454        public static void ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(Type runtimePropertyType, Jso
 0455        {
 0456            throw new InvalidOperationException(SR.Format(SR.ConverterCanConvertMultipleTypes, jsonConverter.GetType(), 
 457        }
 458
 459        [DoesNotReturn]
 460        public static void ThrowNotSupportedException_ObjectWithParameterizedCtorRefMetadataNotSupported(
 461            ReadOnlySpan<byte> propertyName,
 462            ref Utf8JsonReader reader,
 463            scoped ref ReadStack state)
 0464        {
 0465            JsonTypeInfo jsonTypeInfo = state.GetTopJsonTypeInfoWithParameterizedConstructor();
 0466            state.Current.JsonPropertyName = propertyName.ToArray();
 467
 0468            NotSupportedException ex = new NotSupportedException(
 0469                SR.Format(SR.ObjectWithParameterizedCtorRefMetadataNotSupported, jsonTypeInfo.Type));
 0470            ThrowNotSupportedException(ref state, reader, ex);
 471        }
 472
 473        [DoesNotReturn]
 474        public static void ThrowInvalidOperationException_JsonTypeInfoOperationNotPossibleForKind(JsonTypeInfoKind kind)
 0475        {
 0476            throw new InvalidOperationException(SR.Format(SR.InvalidJsonTypeInfoOperationForKind, kind));
 477        }
 478
 479        [DoesNotReturn]
 480        public static void ThrowInvalidOperationException_JsonTypeInfoOnDeserializingCallbacksNotSupported(Type type)
 0481        {
 0482            throw new InvalidOperationException(SR.Format(SR.OnDeserializingCallbacksNotSupported, type));
 483        }
 484
 485        [DoesNotReturn]
 486        public static void ThrowInvalidOperationException_CreateObjectConverterNotCompatible(Type type)
 0487        {
 0488            throw new InvalidOperationException(SR.Format(SR.CreateObjectConverterNotCompatible, type));
 489        }
 490
 491        [DoesNotReturn]
 492        public static void ReThrowWithPath(scoped ref ReadStack state, JsonReaderException ex)
 0493        {
 0494            Debug.Assert(ex.Path is null);
 495
 0496            string path = state.JsonPath();
 0497            string message = ex.Message;
 498
 499            // Insert the "Path" portion before "LineNumber" and "BytePositionInLine".
 500#if NET
 0501            int iPos = message.AsSpan().LastIndexOf(" LineNumber: ");
 502#else
 503            int iPos = message.LastIndexOf(" LineNumber: ", StringComparison.Ordinal);
 504#endif
 0505            if (iPos >= 0)
 0506            {
 0507                message = $"{message.Substring(0, iPos)} Path: {path} |{message.Substring(iPos)}";
 0508            }
 509            else
 0510            {
 0511                message += $" Path: {path}.";
 0512            }
 513
 0514            throw new JsonException(message, path, ex.LineNumber, ex.BytePositionInLine, ex);
 515        }
 516
 517        [DoesNotReturn]
 518        public static void ReThrowWithPath(scoped ref ReadStack state, in Utf8JsonReader reader, Exception ex)
 0519        {
 0520            JsonException jsonException = new JsonException(null, ex);
 0521            AddJsonExceptionInformation(ref state, reader, jsonException);
 0522            throw jsonException;
 523        }
 524
 525        public static void AddJsonExceptionInformation(scoped ref ReadStack state, in Utf8JsonReader reader, JsonExcepti
 0526        {
 0527            Debug.Assert(ex.Path is null); // do not overwrite existing path information
 528
 0529            long lineNumber = reader.CurrentState._lineNumber;
 0530            ex.LineNumber = lineNumber;
 531
 0532            long bytePositionInLine = reader.CurrentState._bytePositionInLine;
 0533            ex.BytePositionInLine = bytePositionInLine;
 534
 0535            string path = state.JsonPath();
 0536            ex.Path = path;
 537
 0538            string? message = ex._message;
 539
 0540            if (string.IsNullOrEmpty(message))
 0541            {
 542                // Use a default message.
 0543                Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ??
 0544                    state.Current.CtorArgumentState?.JsonParameterInfo?.ParameterType ??
 0545                    state.Current.JsonTypeInfo.Type;
 0546                message = SR.Format(SR.DeserializeUnableToConvertValue, propertyType);
 0547                ex.AppendPathInformation = true;
 0548            }
 549
 0550            if (ex.AppendPathInformation)
 0551            {
 0552                message += $" Path: {path} | LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
 0553                ex.SetMessage(message);
 0554            }
 0555        }
 556
 557        [DoesNotReturn]
 558        public static void ReThrowWithPath(ref WriteStack state, Exception ex)
 0559        {
 0560            JsonException jsonException = new JsonException(null, ex);
 0561            AddJsonExceptionInformation(ref state, jsonException);
 0562            throw jsonException;
 563        }
 564
 565        public static void AddJsonExceptionInformation(ref WriteStack state, JsonException ex)
 0566        {
 0567            Debug.Assert(ex.Path is null); // do not overwrite existing path information
 568
 0569            string path = state.PropertyPath();
 0570            ex.Path = path;
 571
 0572            string? message = ex._message;
 0573            if (string.IsNullOrEmpty(message))
 0574            {
 575                // Use a default message.
 0576                message = SR.SerializeUnableToSerialize;
 0577                ex.AppendPathInformation = true;
 0578            }
 579
 0580            if (ex.AppendPathInformation)
 0581            {
 0582                message += $" Path: {path}.";
 0583                ex.SetMessage(message);
 0584            }
 0585        }
 586
 587        [DoesNotReturn]
 588        public static void ThrowInvalidOperationException_SerializationDuplicateAttribute(Type attribute, MemberInfo mem
 0589        {
 0590            string location = memberInfo is Type type ? type.ToString() : $"{memberInfo.DeclaringType}.{memberInfo.Name}
 0591            throw new InvalidOperationException(SR.Format(SR.SerializationDuplicateAttribute, attribute, location));
 592        }
 593
 594        [DoesNotReturn]
 595        public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(Type classType, Type attri
 0596        {
 0597            throw new InvalidOperationException(SR.Format(SR.SerializationDuplicateTypeAttribute, classType, attribute))
 598        }
 599
 600        [DoesNotReturn]
 601        public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute<TAttribute>(Type classType
 0602        {
 0603            throw new InvalidOperationException(SR.Format(SR.SerializationDuplicateTypeAttribute, classType, typeof(TAtt
 604        }
 605
 606        [DoesNotReturn]
 607        public static void ThrowInvalidOperationException_ExtensionDataConflictsWithUnmappedMemberHandling(Type classTyp
 0608        {
 0609            throw new InvalidOperationException(SR.Format(SR.ExtensionDataConflictsWithUnmappedMemberHandling, classType
 610        }
 611
 612        [DoesNotReturn]
 613        public static void ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(JsonPropertyInfo jso
 0614        {
 0615            throw new InvalidOperationException(SR.Format(SR.SerializationDataExtensionPropertyInvalid, jsonPropertyInfo
 616        }
 617
 618        [DoesNotReturn]
 619        public static void ThrowInvalidOperationException_PropertyTypeNotNullable(JsonPropertyInfo jsonPropertyInfo)
 0620        {
 0621            throw new InvalidOperationException(SR.Format(SR.PropertyTypeNotNullable, jsonPropertyInfo.PropertyType));
 622        }
 623
 624        [DoesNotReturn]
 625        public static void ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty()
 0626        {
 0627            throw new InvalidOperationException(SR.NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty);
 628        }
 629
 630        [DoesNotReturn]
 631        public static void ThrowNotSupportedException(scoped ref ReadStack state, in Utf8JsonReader reader, Exception in
 0632        {
 0633            string message = innerException.Message;
 634
 635            // The caller should check to ensure path is not already set.
 0636            Debug.Assert(!message.Contains(" Path: "));
 637
 638            // Obtain the type to show in the message.
 0639            Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
 640
 0641            if (!message.Contains(propertyType.ToString()))
 0642            {
 0643                if (message.Length > 0)
 0644                {
 0645                    message += " ";
 0646                }
 647
 0648                message += SR.Format(SR.SerializationNotSupportedParentType, propertyType);
 0649            }
 650
 0651            long lineNumber = reader.CurrentState._lineNumber;
 0652            long bytePositionInLine = reader.CurrentState._bytePositionInLine;
 0653            message += $" Path: {state.JsonPath()} | LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}
 654
 0655            throw new NotSupportedException(message, innerException);
 656        }
 657
 658        [DoesNotReturn]
 659        public static void ThrowNotSupportedException(ref WriteStack state, Exception innerException)
 0660        {
 0661            string message = innerException.Message;
 662
 663            // The caller should check to ensure path is not already set.
 0664            Debug.Assert(!message.Contains(" Path: "));
 665
 666            // Obtain the type to show in the message.
 0667            Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
 668
 0669            if (!message.Contains(propertyType.ToString()))
 0670            {
 0671                if (message.Length > 0)
 0672                {
 0673                    message += " ";
 0674                }
 675
 0676                message += SR.Format(SR.SerializationNotSupportedParentType, propertyType);
 0677            }
 678
 0679            message += $" Path: {state.PropertyPath()}.";
 680
 0681            throw new NotSupportedException(message, innerException);
 682        }
 683
 684        [DoesNotReturn]
 685        public static void ThrowNotSupportedException_DeserializeNoConstructor(JsonTypeInfo typeInfo, ref Utf8JsonReader
 0686        {
 0687            Type type = typeInfo.Type;
 688            string message;
 689
 0690            if (type.IsInterface || type.IsAbstract)
 0691            {
 0692                if (typeInfo.PolymorphicTypeResolver?.UsesTypeDiscriminators is true)
 0693                {
 0694                    message = SR.Format(SR.DeserializationMustSpecifyTypeDiscriminator, type);
 0695                }
 0696                else if (typeInfo.Kind is JsonTypeInfoKind.Enumerable or JsonTypeInfoKind.Dictionary)
 0697                {
 0698                    message = SR.Format(SR.CannotPopulateCollection, type);
 0699                }
 700                else
 0701                {
 0702                    message = SR.Format(SR.DeserializeInterfaceOrAbstractType, type);
 0703                }
 0704            }
 705            else
 0706            {
 0707                message = SR.Format(SR.DeserializeNoConstructor, nameof(JsonConstructorAttribute), type);
 0708            }
 709
 0710            ThrowNotSupportedException(ref state, reader, new NotSupportedException(message));
 711        }
 712
 713        [DoesNotReturn]
 714        public static void ThrowNotSupportedException_CannotPopulateCollection(Type type, ref Utf8JsonReader reader, sco
 0715        {
 0716            ThrowNotSupportedException(ref state, reader, new NotSupportedException(SR.Format(SR.CannotPopulateCollectio
 717        }
 718
 719        [DoesNotReturn]
 720        public static void ThrowJsonException_MetadataValuesInvalidToken(JsonTokenType tokenType)
 0721        {
 0722            ThrowJsonException(SR.Format(SR.MetadataInvalidTokenAfterValues, tokenType));
 723        }
 724
 725        [DoesNotReturn]
 726        public static void ThrowJsonException_MetadataReferenceNotFound(string id)
 0727        {
 0728            ThrowJsonException(SR.Format(SR.MetadataReferenceNotFound, id));
 729        }
 730
 731        [DoesNotReturn]
 732        public static void ThrowJsonException_MetadataValueWasNotString(JsonTokenType tokenType)
 0733        {
 0734            ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, tokenType));
 735        }
 736
 737        [DoesNotReturn]
 738        public static void ThrowJsonException_MetadataValueWasNotString(JsonValueKind valueKind)
 0739        {
 0740            ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, valueKind));
 741        }
 742
 743        [DoesNotReturn]
 744        public static void ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties(ReadOnlySpan<byte> pro
 0745        {
 0746            state.Current.JsonPropertyName = propertyName.ToArray();
 0747            ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties();
 748        }
 749
 750        [DoesNotReturn]
 751        public static void ThrowJsonException_MetadataUnexpectedProperty(ReadOnlySpan<byte> propertyName, scoped ref Rea
 0752        {
 0753            state.Current.JsonPropertyName = propertyName.ToArray();
 0754            ThrowJsonException(SR.MetadataUnexpectedProperty);
 755        }
 756
 757        [DoesNotReturn]
 758        public static void ThrowJsonException_UnmappedJsonProperty(Type type, string unmappedPropertyName)
 0759        {
 0760            throw new JsonException(SR.Format(SR.UnmappedJsonProperty, unmappedPropertyName, type));
 761        }
 762
 763        [DoesNotReturn]
 764        public static void ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties()
 0765        {
 0766            ThrowJsonException(SR.MetadataReferenceCannotContainOtherProperties);
 767        }
 768
 769        [DoesNotReturn]
 770        public static void ThrowJsonException_MetadataIdCannotBeCombinedWithRef(ReadOnlySpan<byte> propertyName, scoped 
 0771        {
 0772            state.Current.JsonPropertyName = propertyName.ToArray();
 0773            ThrowJsonException(SR.MetadataIdCannotBeCombinedWithRef);
 774        }
 775
 776        [DoesNotReturn]
 777        public static void ThrowJsonException_MetadataStandaloneValuesProperty(scoped ref ReadStack state, ReadOnlySpan<
 0778        {
 0779            state.Current.JsonPropertyName = propertyName.ToArray();
 0780            ThrowJsonException(SR.MetadataStandaloneValuesProperty);
 781        }
 782
 783        [DoesNotReturn]
 784        public static void ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(ReadOnlySpan<byte> propertyNa
 0785        {
 786            // Set PropertyInfo or KeyName to write down the conflicting property name in JsonException.Path
 0787            if (state.Current.IsProcessingDictionary())
 0788            {
 0789                state.Current.JsonPropertyNameAsString = reader.GetString();
 0790            }
 791            else
 0792            {
 0793                state.Current.JsonPropertyName = propertyName.ToArray();
 0794            }
 795
 0796            ThrowJsonException(SR.MetadataInvalidPropertyWithLeadingDollarSign);
 797        }
 798
 799        [DoesNotReturn]
 800        public static void ThrowJsonException_MetadataDuplicateIdFound(string id)
 0801        {
 0802            ThrowJsonException(SR.Format(SR.MetadataDuplicateIdFound, id));
 803        }
 804
 805        [DoesNotReturn]
 806        public static void ThrowJsonException_DuplicateMetadataProperty(ReadOnlySpan<byte> utf8PropertyName)
 0807        {
 0808            ThrowJsonException(SR.Format(SR.DuplicateMetadataProperty, Encoding.UTF8.GetString(utf8PropertyName)));
 809        }
 810
 811        [DoesNotReturn]
 812        public static void ThrowJsonException_MetadataInvalidReferenceToValueType(Type propertyType)
 0813        {
 0814            ThrowJsonException(SR.Format(SR.MetadataInvalidReferenceToValueType, propertyType));
 815        }
 816
 817        [DoesNotReturn]
 818        public static void ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(scoped ref ReadStack state, Type pr
 0819        {
 0820            state.Current.JsonPropertyName = reader.HasValueSequence ? reader.ValueSequence.ToArray() : reader.ValueSpan
 0821            string propertyNameAsString = reader.GetString()!;
 822
 0823            ThrowJsonException(SR.Format(SR.MetadataPreservedArrayFailed,
 0824                SR.Format(SR.MetadataInvalidPropertyInArrayMetadata, propertyNameAsString),
 0825                SR.Format(SR.DeserializeUnableToConvertValue, propertyType)));
 826        }
 827
 828        [DoesNotReturn]
 829        public static void ThrowJsonException_MetadataPreservedArrayValuesNotFound(scoped ref ReadStack state, Type prop
 0830        {
 831            // Missing $values, JSON path should point to the property's object.
 0832            state.Current.JsonPropertyName = null;
 833
 0834            ThrowJsonException(SR.Format(SR.MetadataPreservedArrayFailed,
 0835                SR.MetadataStandaloneValuesProperty,
 0836                SR.Format(SR.DeserializeUnableToConvertValue, propertyType)));
 837        }
 838
 839        [DoesNotReturn]
 840        public static void ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(Type propertyType)
 0841        {
 0842            ThrowJsonException(SR.Format(SR.MetadataCannotParsePreservedObjectToImmutable, propertyType));
 843        }
 844
 845        [DoesNotReturn]
 846        public static void ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(string reference
 0847        {
 0848            throw new InvalidOperationException(SR.Format(SR.MetadataReferenceOfTypeCannotBeAssignedToType, referenceId,
 849        }
 850
 851        [DoesNotReturn]
 852        public static void ThrowInvalidOperationException_JsonPropertyInfoIsBoundToDifferentJsonTypeInfo(JsonPropertyInf
 0853        {
 0854            Debug.Assert(propertyInfo.DeclaringTypeInfo is not null, "We should not throw this exception when ParentType
 0855            throw new InvalidOperationException(SR.Format(SR.JsonPropertyInfoBoundToDifferentParent, propertyInfo.Name, 
 856        }
 857
 858        [DoesNotReturn]
 859        internal static void ThrowUnexpectedMetadataException(
 860            ReadOnlySpan<byte> propertyName,
 861            ref Utf8JsonReader reader,
 862            scoped ref ReadStack state)
 0863        {
 864
 0865            MetadataPropertyName name = JsonSerializer.GetMetadataPropertyName(propertyName, state.Current.BaseJsonTypeI
 0866            if (name != 0)
 0867            {
 0868                ThrowJsonException_MetadataUnexpectedProperty(propertyName, ref state);
 869            }
 870            else
 0871            {
 0872                ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(propertyName, ref state, reader);
 873            }
 874        }
 875
 876        [DoesNotReturn]
 877        public static void ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
 0878        {
 0879            throw new NotSupportedException(SR.Format(SR.NoMetadataForType, type, resolver?.ToString() ?? "<null>"));
 880        }
 881
 882        public static NotSupportedException GetNotSupportedException_AmbiguousMetadataForType(Type type, Type match1, Ty
 0883        {
 0884            return new NotSupportedException(SR.Format(SR.AmbiguousMetadataForType, type, match1, match2));
 0885        }
 886
 887        [DoesNotReturn]
 888        public static void ThrowNotSupportedException_ConstructorContainsNullParameterNames(Type declaringType)
 0889        {
 0890            throw new NotSupportedException(SR.Format(SR.ConstructorContainsNullParameterNames, declaringType));
 891        }
 892
 893        [DoesNotReturn]
 894        public static void ThrowInvalidOperationException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
 0895        {
 0896            throw new InvalidOperationException(SR.Format(SR.NoMetadataForType, type, resolver?.ToString() ?? "<null>"))
 897        }
 898
 899        public static Exception GetInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver
 0900        {
 0901            return new InvalidOperationException(SR.Format(SR.NoMetadataForTypeProperties, resolver?.ToString() ?? "<nul
 0902        }
 903
 904        [DoesNotReturn]
 905        public static void ThrowInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, T
 0906        {
 0907            throw GetInvalidOperationException_NoMetadataForTypeProperties(resolver, type);
 908        }
 909
 910        [DoesNotReturn]
 911        public static void ThrowMissingMemberException_MissingFSharpCoreMember(string missingFsharpCoreMember)
 0912        {
 0913            throw new MissingMemberException(SR.Format(SR.MissingFSharpCoreMember, missingFsharpCoreMember));
 914        }
 915
 916        [DoesNotReturn]
 917        public static void ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(Type derivedType)
 0918        {
 0919            throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedTyp
 920        }
 921
 922        [DoesNotReturn]
 923        public static void ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(Type derivedType)
 0924        {
 0925            throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedTyp
 926        }
 927
 928        [DoesNotReturn]
 929        public static void ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
 0930        {
 0931            throw new NotSupportedException(SR.Format(SR.Polymorphism_RuntimeTypeNotSupported, runtimeType, baseType));
 932        }
 933
 934        [DoesNotReturn]
 935        public static void ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(Type baseType, Type runtimeType, Type 
 0936        {
 0937            throw new NotSupportedException(SR.Format(SR.Polymorphism_RuntimeTypeDiamondAmbiguity, runtimeType, derivedT
 938        }
 939
 940        [DoesNotReturn]
 941        public static void ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(Type baseType)
 0942        {
 0943            throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDoesNotSupportPolymorphism, baseType));
 944        }
 945
 946        [DoesNotReturn]
 947        public static void ThrowInvalidOperationException_DerivedTypeNotSupported(Type baseType, Type derivedType)
 0948        {
 0949            throw new InvalidOperationException(SR.Format(SR.Polymorphism_DerivedTypeIsNotSupported, derivedType, baseTy
 950        }
 951
 952        [DoesNotReturn]
 953        public static void ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)
 0954        {
 0955            throw new InvalidOperationException(SR.Format(SR.Polymorphism_DerivedTypeIsAlreadySpecified, baseType, deriv
 956        }
 957
 958        [DoesNotReturn]
 959        public static void ThrowInvalidOperationException_OpenGenericDerivedTypeCouldNotBeResolved(Type baseType, Type d
 0960        {
 0961            throw new InvalidOperationException(SR.Format(SR.Polymorphism_OpenGenericDerivedTypeCouldNotBeResolved, deri
 962        }
 963
 964        [DoesNotReturn]
 965        public static void ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(Type baseType, object typ
 0966        {
 0967            throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDicriminatorIdIsAlreadySpecified, baseType
 968        }
 969
 970        [DoesNotReturn]
 971        public static void ThrowInvalidOperationException_InferredDerivedTypeIsNotAccessible(Type baseType, Type derived
 0972        {
 0973            throw new InvalidOperationException(SR.Format(SR.Polymorphism_InferredDerivedTypeIsNotAccessible, derivedTyp
 974        }
 975
 976        [DoesNotReturn]
 977        public static void ThrowInvalidOperationException_InferClosedTypePolymorphismOnNonClosedType(Type baseType)
 0978        {
 0979            throw new InvalidOperationException(SR.Format(SR.Polymorphism_InferClosedTypePolymorphismOnNonClosedType, ba
 980        }
 981
 982        [DoesNotReturn]
 983        public static void ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName()
 0984        {
 0985            throw new InvalidOperationException(SR.Polymorphism_InvalidCustomTypeDiscriminatorPropertyName);
 986        }
 987
 988        [DoesNotReturn]
 989        public static void ThrowInvalidOperationException_PropertyConflictsWithMetadataPropertyName(Type type, string pr
 0990        {
 0991            throw new InvalidOperationException(SR.Format(SR.Polymorphism_PropertyConflictsWithMetadataPropertyName, typ
 992        }
 993
 994        [DoesNotReturn]
 995        public static void ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(Type ba
 0996        {
 0997            throw new InvalidOperationException(SR.Format(SR.Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes, baseT
 998        }
 999
 1000        [DoesNotReturn]
 1001        public static void ThrowJsonException_UnionDoesNotAcceptNull(Type unionType)
 01002        {
 01003            ThrowJsonException(SR.Format(SR.UnionDoesNotAcceptNull, unionType));
 1004        }
 1005
 1006        [DoesNotReturn]
 1007        public static void ThrowJsonException_UnionRuntimeTypeNotMatchedToCase(Type unionType, Type runtimeType)
 01008        {
 01009            ThrowJsonException(SR.Format(SR.UnionRuntimeTypeNotMatchedToCase, runtimeType, unionType));
 1010        }
 1011
 1012        [DoesNotReturn]
 1013        public static void ThrowJsonException_UnionCannotCreateValue(Type unionType)
 01014        {
 01015            ThrowJsonException(SR.Format(SR.UnionCannotCreateValue, unionType));
 1016        }
 1017
 1018        [DoesNotReturn]
 1019        public static void ThrowJsonException_UnionCannotReadValue(Type unionType)
 01020        {
 01021            ThrowJsonException(SR.Format(SR.UnionCannotReadValue, unionType));
 1022        }
 1023
 1024        [DoesNotReturn]
 1025        public static void ThrowJsonException_UnionTypeClassifierReturnedNull(Type unionType, JsonTokenType tokenType)
 01026        {
 01027            ThrowJsonException(SR.Format(SR.UnionTypeClassifierReturnedNull, unionType, tokenType));
 1028        }
 1029
 1030        [DoesNotReturn]
 1031        public static void ThrowJsonException_UnionAmbiguousJsonValueType(Type unionType, JsonValueType valueType)
 01032        {
 01033            ThrowJsonException(SR.Format(SR.UnionAmbiguousJsonValueType, valueType, unionType));
 1034        }
 1035
 1036        [DoesNotReturn]
 1037        public static void ThrowJsonException_UnionJsonTokenTypeNotSupported(Type unionType, JsonTokenType tokenType)
 01038        {
 01039            ThrowJsonException(SR.Format(SR.UnionJsonTokenTypeNotSupported, tokenType, unionType));
 1040        }
 1041
 1042        [DoesNotReturn]
 1043        public static void ThrowInvalidOperationException_UnionCasesNotPopulated(Type unionType)
 01044        {
 01045            throw new InvalidOperationException(SR.Format(SR.UnionCasesNotPopulated, unionType));
 1046        }
 1047
 1048        [DoesNotReturn]
 1049        public static void ThrowInvalidOperationException_UnionCannotCreateValue(Type unionType)
 01050        {
 01051            throw new InvalidOperationException(SR.Format(SR.UnionCannotCreateValue, unionType));
 1052        }
 1053
 1054        [DoesNotReturn]
 1055        public static void ThrowInvalidOperationException_UnionCannotReadValue(Type unionType)
 01056        {
 01057            throw new InvalidOperationException(SR.Format(SR.UnionCannotReadValue, unionType));
 1058        }
 1059
 1060        [DoesNotReturn]
 1061        public static void ThrowInvalidOperationException_UnionTypeStructuralClassifierOnlyForUnions(Type unionType)
 01062        {
 01063            throw new InvalidOperationException(SR.Format(SR.UnionTypeStructuralClassifierOnlyForUnions, unionType));
 1064        }
 1065
 1066        [DoesNotReturn]
 1067        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierCaseNotSupported(
 1068            Type unionType,
 1069            Type caseType)
 01070        {
 01071            throw new NotSupportedException(
 01072                SR.Format(
 01073                    SR.UnionTypeStructuralClassifierCaseNotSupported,
 01074                    unionType,
 01075                    caseType));
 1076        }
 1077
 1078        [DoesNotReturn]
 1079        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierPreserveReferencesNotSupported(Type u
 01080        {
 01081            throw new NotSupportedException(
 01082                SR.Format(
 01083                    SR.UnionTypeStructuralClassifierPreserveReferencesNotSupported,
 01084                    unionType));
 1085        }
 1086
 1087        [DoesNotReturn]
 1088        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierAmbiguousCases(
 1089            Type unionType,
 1090            Type conflictingCaseType,
 1091            Type caseType,
 1092            JsonValueType valueType)
 01093        {
 01094            throw new NotSupportedException(
 01095                SR.Format(
 01096                    SR.UnionTypeStructuralClassifierAmbiguousCases,
 01097                    unionType,
 01098                    conflictingCaseType,
 01099                    caseType,
 01100                    valueType));
 1101        }
 1102
 1103        [DoesNotReturn]
 1104        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierUnreachableObjectCase(
 1105            Type unionType,
 1106            Type unreachableCaseType,
 1107            Type shadowingCaseType)
 01108        {
 01109            throw new NotSupportedException(
 01110                SR.Format(
 01111                    SR.UnionTypeStructuralClassifierUnreachableObjectCase,
 01112                    unionType,
 01113                    unreachableCaseType,
 01114                    shadowingCaseType));
 1115        }
 1116
 1117        [DoesNotReturn]
 1118        public static void ThrowInvalidOperationException_TypeClassifierMustDeriveFromJsonTypeClassifierFactory(Type cla
 01119        {
 01120            throw new InvalidOperationException(SR.Format(SR.TypeClassifierMustDeriveFromJsonTypeClassifierFactory, clas
 1121        }
 1122
 1123        [DoesNotReturn]
 1124        public static void ThrowInvalidOperationException_TypeClassifierNotSupported(Type classifierType, Type type)
 01125        {
 01126            throw new InvalidOperationException(SR.Format(SR.TypeClassifierNotSupported, classifierType, type));
 1127        }
 1128
 1129        [DoesNotReturn]
 1130        public static void ThrowInvalidOperationException_UnsupportedEnumIdentifier(Type enumType, string? enumName)
 01131        {
 01132            throw new InvalidOperationException(SR.Format(SR.UnsupportedEnumIdentifier, enumType.Name, enumName));
 1133        }
 1134
 1135        [DoesNotReturn]
 1136        public static void ThrowJsonException_UnrecognizedTypeDiscriminator(object typeDiscriminator)
 01137        {
 01138            ThrowJsonException(SR.Format(SR.Polymorphism_UnrecognizedTypeDiscriminator, typeDiscriminator));
 1139        }
 1140
 1141        [DoesNotReturn]
 1142        public static void ThrowArgumentException_JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo(string para
 01143        {
 01144            throw new ArgumentException(SR.JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo, paramName: parame
 1145        }
 1146
 1147        [DoesNotReturn]
 1148        public static void ThrowOperationCanceledException_PipeWriteCanceled()
 01149        {
 01150            throw new OperationCanceledException(SR.PipeWriterCanceled);
 1151        }
 1152
 1153        [DoesNotReturn]
 1154        public static void ThrowOperationCanceledException_PipeReadCanceled()
 01155        {
 01156            throw new OperationCanceledException(SR.PipeReaderCanceled);
 1157        }
 1158
 1159        [DoesNotReturn]
 1160        public static void ThrowInvalidOperationException_PipeWriterDoesNotImplementUnflushedBytes(PipeWriter pipeWriter
 01161        {
 01162            throw new InvalidOperationException(SR.Format(SR.PipeWriter_DoesNotImplementUnflushedBytes, pipeWriter.GetTy
 1163        }
 1164
 1165        [DoesNotReturn]
 1166        public static void ThrowNotSupportedException_JsonSchemaExporterDoesNotSupportReferenceHandlerPreserve()
 01167        {
 01168            throw new NotSupportedException(SR.JsonSchemaExporter_ReferenceHandlerPreserve_NotSupported);
 1169        }
 1170
 1171        [DoesNotReturn]
 1172        public static void ThrowInvalidOperationException_JsonSchemaExporterDepthTooLarge()
 01173        {
 01174            throw new InvalidOperationException(SR.JsonSchemaExporter_DepthTooLarge);
 1175        }
 1176    }
 1177}
 1178

Methods/Properties

ThrowArgumentNullException(System.String)
ThrowArgumentOutOfRangeException_NewLine(System.String)
ThrowArgumentOutOfRangeException_IndentCharacter(System.String)
ThrowArgumentOutOfRangeException_IndentSize(System.String,System.Int32,System.Int32)
ThrowArgumentOutOfRangeException_MaxDepthMustBePositive(System.String)
ThrowArgumentOutOfRangeException_JsonNumberExponentTooLarge(System.String)
GetArgumentOutOfRangeException(System.String,System.String)
ThrowArgumentOutOfRangeException_CommentEnumMustBeInRange(System.String)
ThrowArgumentOutOfRangeException_JsonConverterFactory_TypeNotSupported(System.Type)
ThrowArgumentOutOfRangeException_NeedNonNegNum(System.String)
ThrowArgumentException_InvalidOffLen()
GetArgumentException(System.String)
ThrowArgumentException(System.String)
ThrowArgumentException_DestinationTooShort()
ThrowArgumentException_PropertyNameTooLarge(System.Int32)
ThrowArgumentException_ValueTooLarge(System.Int64)
ThrowArgumentException_ValueNotSupported()
ThrowInvalidOperationException_NeedLargerSpan()
ThrowPropertyNameTooLargeArgumentException(System.Int32)
ThrowArgumentException(System.ReadOnlySpan`1<System.Byte>,System.ReadOnlySpan`1<System.Byte>)
ThrowArgumentException(System.ReadOnlySpan`1<System.Byte>,System.ReadOnlySpan`1<System.Char>)
ThrowArgumentException(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Byte>)
ThrowArgumentException(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>)
ThrowInvalidOperationOrArgumentException(System.ReadOnlySpan`1<System.Byte>,System.Int32,System.Int32)
ThrowInvalidOperationException(System.Int32,System.Int32)
ThrowInvalidOperationException(System.String)
GetInvalidOperationException(System.String)
ThrowInvalidOperationOrArgumentException(System.ReadOnlySpan`1<System.Char>,System.Int32,System.Int32)
GetInvalidOperationException_ExpectedArray(System.Text.Json.JsonTokenType)
GetInvalidOperationException_ExpectedObject(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedNumber(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedBoolean(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedString(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedPropertyName(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedStringComparison(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedComment(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_CannotSkipOnPartial()
ThrowInvalidOperationException_CannotMixEncodings(System.Text.Json.Utf8JsonWriter/EnclosingContainerType,System.Text.Json.Utf8JsonWriter/EnclosingContainerType)
GetEncodingName(System.Text.Json.Utf8JsonWriter/EnclosingContainerType)
GetInvalidOperationException(System.String,System.Text.Json.JsonTokenType)
GetInvalidOperationException(System.Text.Json.JsonTokenType)
ThrowJsonElementWrongTypeException(System.Text.Json.JsonTokenType,System.Text.Json.JsonTokenType)
GetJsonElementWrongTypeException(System.Text.Json.JsonValueKind,System.Text.Json.JsonValueKind)
GetJsonElementWrongTypeException(System.String,System.Text.Json.JsonValueKind)
ThrowJsonReaderException(System.Text.Json.Utf8JsonReader&,System.Text.Json.ExceptionResource,System.Byte,System.ReadOnlySpan`1<System.Byte>)
GetJsonReaderException(System.Text.Json.Utf8JsonReader&,System.Text.Json.ExceptionResource,System.Byte,System.ReadOnlySpan`1<System.Byte>)
IsPrintable(System.Byte)
GetPrintableString(System.Byte)
GetResourceString(System.Text.Json.Utf8JsonReader&,System.Text.Json.ExceptionResource,System.Byte,System.String)
ThrowInvalidOperationException(System.Text.Json.ExceptionResource,System.Int32,System.Int32,System.Byte,System.Text.Json.JsonTokenType)
ThrowArgumentException_InvalidCommentValue()
ThrowArgumentException_InvalidUTF8(System.ReadOnlySpan`1<System.Byte>)
ThrowArgumentException_InvalidUTF16(System.Int32)
ThrowInvalidOperationException_ReadInvalidUTF16(System.Int32)
ThrowInvalidOperationException_ReadIncompleteUTF16()
GetInvalidOperationException_ReadInvalidUTF8(System.Text.DecoderFallbackException)
GetArgumentException_ReadInvalidUTF16(System.Text.EncoderFallbackException)
GetInvalidOperationException(System.String,System.Exception)
GetInvalidOperationException(System.Text.Json.ExceptionResource,System.Int32,System.Int32,System.Byte,System.Text.Json.JsonTokenType)
ThrowOutOfMemoryException(System.UInt32)
GetResourceString(System.Text.Json.ExceptionResource,System.Int32,System.Int32,System.Byte,System.Text.Json.JsonTokenType)
ThrowFormatException()
ThrowFormatException(System.Text.Json.NumericType)
ThrowFormatException(System.Text.Json.DataType)
ThrowInvalidOperationException_ExpectedChar(System.Text.Json.JsonTokenType)
ThrowObjectDisposedException_Utf8JsonWriter()
ThrowObjectDisposedException_JsonDocument()
ThrowInsufficientExecutionStackException_JsonElementDeepEqualsInsufficientExecutionStack()
ThrowArgumentException_NodeValueNotAllowed(System.String)
ThrowInvalidOperationException_NodeAlreadyHasParent()
ThrowInvalidOperationException_NodeCycleDetected()
ThrowInvalidOperationException_NodeElementCannotBeObjectOrArray()
ThrowInvalidOperationException_NodeWrongType(System.ReadOnlySpan`1<System.String>)
ThrowInvalidOperationException_NodeParentWrongType(System.String)
ThrowInvalidOperationException_NodeUnableToConvert(System.Type,System.Type)
ThrowInvalidOperationException_NodeUnableToConvertElement(System.Text.Json.JsonValueKind,System.Type)
ThrowArgumentException_DeserializeWrongType(System.Type,System.Object)
ThrowArgumentException_SerializerDoesNotSupportComments(System.String)
ThrowNotSupportedException_SerializationNotSupported(System.Type)
ThrowNotSupportedException_TypeRequiresAsyncSerialization(System.Type)
ThrowNotSupportedException_DictionaryKeyTypeNotSupported(System.Type,System.Text.Json.Serialization.JsonConverter)
ThrowJsonException_DeserializeUnableToConvertValue(System.Type)
ThrowInvalidCastException_DeserializeUnableToAssignValue(System.Type,System.Type)
ThrowInvalidOperationException_DeserializeUnableToAssignNull(System.Type)
ThrowJsonException_PropertyGetterDisallowNull(System.String,System.Type)
ThrowJsonException_PropertySetterDisallowNull(System.String,System.Type)
ThrowJsonException_ConstructorParameterDisallowNull(System.String,System.Type)
ThrowInvalidOperationException_ObjectCreationHandlingPopulateNotSupportedByConverter(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyMustHaveAGetter(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyValueTypeMustHaveASetter(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowPolymorphicDeserialization(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReadOnlyMember(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReferenceHandling()
ThrowNotSupportedException_ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors()
ThrowJsonException_SerializationConverterRead(System.Text.Json.Serialization.JsonConverter)
ThrowJsonException_SerializationConverterWrite(System.Text.Json.Serialization.JsonConverter)
ThrowJsonException_SerializerCycleDetected(System.Int32)
ThrowJsonException(System.String)
ThrowArgumentException_CannotSerializeInvalidType(System.String,System.Type,System.Type,System.String)
ThrowInvalidOperationException_CannotSerializeInvalidType(System.Type,System.Type,System.Reflection.MemberInfo)
ThrowInvalidOperationException_SerializationConverterNotCompatible(System.Type,System.Type)
ThrowInvalidOperationException_ResolverTypeNotCompatible(System.Type,System.Type)
ThrowInvalidOperationException_ResolverTypeInfoOptionsNotCompatible()
ThrowInvalidOperationException_JsonSerializerOptionsNoTypeInfoResolverSpecified()
ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled()
ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(System.Type,System.Reflection.MemberInfo)
ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(System.Type,System.Reflection.MemberInfo,System.Type)
ThrowInvalidOperationException_SerializationConverterOnAttributeOpenGenericNotCompatible(System.Type,System.Reflection.MemberInfo,System.Type)
ThrowInvalidOperationException_SerializerOptionsReadOnly(System.Text.Json.Serialization.JsonSerializerContext)
ThrowInvalidOperationException_DefaultTypeInfoResolverImmutable()
ThrowInvalidOperationException_TypeInfoResolverChainImmutable()
ThrowInvalidOperationException_TypeInfoImmutable()
ThrowInvalidOperationException_InvalidChainedResolver()
ThrowInvalidOperationException_SerializerPropertyNameConflict(System.Type,System.String)
ThrowInvalidOperationException_SerializerPropertyNameNull(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_JsonPropertyRequiredAndNotDeserializable(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_JsonPropertyRequiredAndExtensionData(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowJsonException_JsonRequiredPropertyMissing(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Collections.BitArray)
ThrowJsonException_JsonRequiredPropertyMissing(System.Type,System.String)
AppendMissingProperty(System.Text.StringBuilder,System.String)
ThrowJsonException_DuplicatePropertyNotAllowed(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowJsonException_DuplicatePropertyNotAllowed()
ThrowJsonException_DuplicatePropertyNotAllowed(System.String)
ThrowJsonException_DuplicatePropertyNotAllowed(System.ReadOnlySpan`1<System.Byte>)
Truncate(System.ReadOnlySpan`1<System.Char>)
ThrowInvalidOperationException_NamingPolicyReturnNull(System.Text.Json.JsonNamingPolicy)
ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(System.Type)
ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactory(System.Type)
ThrowInvalidOperationException_MultiplePropertiesBindToConstructorParameters(System.Type,System.String,System.String,System.String)
ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(System.Type)
ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(System.String,System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(System.String,System.Type)
ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(System.String,System.Type)
ThrowInvalidOperationException_NumberHandlingOnPropertyInvalid(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(System.Type,System.Text.Json.Serialization.JsonConverter)
ThrowNotSupportedException_ObjectWithParameterizedCtorRefMetadataNotSupported(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowInvalidOperationException_JsonTypeInfoOperationNotPossibleForKind(System.Text.Json.Serialization.Metadata.JsonTypeInfoKind)
ThrowInvalidOperationException_JsonTypeInfoOnDeserializingCallbacksNotSupported(System.Type)
ThrowInvalidOperationException_CreateObjectConverterNotCompatible(System.Type)
ReThrowWithPath(System.Text.Json.ReadStack&,System.Text.Json.JsonReaderException)
ReThrowWithPath(System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&,System.Exception)
AddJsonExceptionInformation(System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&,System.Text.Json.JsonException)
ReThrowWithPath(System.Text.Json.WriteStack&,System.Exception)
AddJsonExceptionInformation(System.Text.Json.WriteStack&,System.Text.Json.JsonException)
ThrowInvalidOperationException_SerializationDuplicateAttribute(System.Type,System.Reflection.MemberInfo)
ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(System.Type,System.Type)
ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(System.Type)
ThrowInvalidOperationException_ExtensionDataConflictsWithUnmappedMemberHandling(System.Type,System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_PropertyTypeNotNullable(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty()
ThrowNotSupportedException(System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&,System.Exception)
ThrowNotSupportedException(System.Text.Json.WriteStack&,System.Exception)
ThrowNotSupportedException_DeserializeNoConstructor(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowNotSupportedException_CannotPopulateCollection(System.Type,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowJsonException_MetadataValuesInvalidToken(System.Text.Json.JsonTokenType)
ThrowJsonException_MetadataReferenceNotFound(System.String)
ThrowJsonException_MetadataValueWasNotString(System.Text.Json.JsonTokenType)
ThrowJsonException_MetadataValueWasNotString(System.Text.Json.JsonValueKind)
ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&)
ThrowJsonException_MetadataUnexpectedProperty(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&)
ThrowJsonException_UnmappedJsonProperty(System.Type,System.String)
ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties()
ThrowJsonException_MetadataIdCannotBeCombinedWithRef(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&)
ThrowJsonException_MetadataStandaloneValuesProperty(System.Text.Json.ReadStack&,System.ReadOnlySpan`1<System.Byte>)
ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&)
ThrowJsonException_MetadataDuplicateIdFound(System.String)
ThrowJsonException_DuplicateMetadataProperty(System.ReadOnlySpan`1<System.Byte>)
ThrowJsonException_MetadataInvalidReferenceToValueType(System.Type)
ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(System.Text.Json.ReadStack&,System.Type,System.Text.Json.Utf8JsonReader&)
ThrowJsonException_MetadataPreservedArrayValuesNotFound(System.Text.Json.ReadStack&,System.Type)
ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(System.Type)
ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(System.String,System.Type,System.Type)
ThrowInvalidOperationException_JsonPropertyInfoIsBoundToDifferentJsonTypeInfo(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowUnexpectedMetadataException(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowNotSupportedException_NoMetadataForType(System.Type,System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver)
GetNotSupportedException_AmbiguousMetadataForType(System.Type,System.Type,System.Type)
ThrowNotSupportedException_ConstructorContainsNullParameterNames(System.Type)
ThrowInvalidOperationException_NoMetadataForType(System.Type,System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver)
GetInvalidOperationException_NoMetadataForTypeProperties(System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver,System.Type)
ThrowInvalidOperationException_NoMetadataForTypeProperties(System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver,System.Type)
ThrowMissingMemberException_MissingFSharpCoreMember(System.String)
ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(System.Type)
ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(System.Type)
ThrowNotSupportedException_RuntimeTypeNotSupported(System.Type,System.Type)
ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(System.Type,System.Type,System.Type,System.Type)
ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(System.Type)
ThrowInvalidOperationException_DerivedTypeNotSupported(System.Type,System.Type)
ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(System.Type,System.Type)
ThrowInvalidOperationException_OpenGenericDerivedTypeCouldNotBeResolved(System.Type,System.Type,System.String)
ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(System.Type,System.Object)
ThrowInvalidOperationException_InferredDerivedTypeIsNotAccessible(System.Type,System.Type)
ThrowInvalidOperationException_InferClosedTypePolymorphismOnNonClosedType(System.Type)
ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName()
ThrowInvalidOperationException_PropertyConflictsWithMetadataPropertyName(System.Type,System.String)
ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(System.Type)
ThrowJsonException_UnionDoesNotAcceptNull(System.Type)
ThrowJsonException_UnionRuntimeTypeNotMatchedToCase(System.Type,System.Type)
ThrowJsonException_UnionCannotCreateValue(System.Type)
ThrowJsonException_UnionCannotReadValue(System.Type)
ThrowJsonException_UnionTypeClassifierReturnedNull(System.Type,System.Text.Json.JsonTokenType)
ThrowJsonException_UnionAmbiguousJsonValueType(System.Type,System.Text.Json.Serialization.JsonValueType)
ThrowJsonException_UnionJsonTokenTypeNotSupported(System.Type,System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_UnionCasesNotPopulated(System.Type)
ThrowInvalidOperationException_UnionCannotCreateValue(System.Type)
ThrowInvalidOperationException_UnionCannotReadValue(System.Type)
ThrowInvalidOperationException_UnionTypeStructuralClassifierOnlyForUnions(System.Type)
ThrowNotSupportedException_UnionTypeStructuralClassifierCaseNotSupported(System.Type,System.Type)
ThrowNotSupportedException_UnionTypeStructuralClassifierPreserveReferencesNotSupported(System.Type)
ThrowNotSupportedException_UnionTypeStructuralClassifierAmbiguousCases(System.Type,System.Type,System.Type,System.Text.Json.Serialization.JsonValueType)
ThrowNotSupportedException_UnionTypeStructuralClassifierUnreachableObjectCase(System.Type,System.Type,System.Type)
ThrowInvalidOperationException_TypeClassifierMustDeriveFromJsonTypeClassifierFactory(System.Type,System.Type)
ThrowInvalidOperationException_TypeClassifierNotSupported(System.Type,System.Type)
ThrowInvalidOperationException_UnsupportedEnumIdentifier(System.Type,System.String)
ThrowJsonException_UnrecognizedTypeDiscriminator(System.Object)
ThrowArgumentException_JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo(System.String)
ThrowOperationCanceledException_PipeWriteCanceled()
ThrowOperationCanceledException_PipeReadCanceled()
ThrowInvalidOperationException_PipeWriterDoesNotImplementUnflushedBytes(System.IO.Pipelines.PipeWriter)
ThrowNotSupportedException_JsonSchemaExporterDoesNotSupportReferenceHandlerPreserve()
ThrowInvalidOperationException_JsonSchemaExporterDepthTooLarge()