< Summary

Line coverage
9%
Covered lines: 77
Uncovered lines: 742
Coverable lines: 819
Total lines: 2025
Line coverage: 9.4%
Branch coverage
17%
Covered branches: 33
Total branches: 188
Branch coverage: 17.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

D:\runner\runtime\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)
 0225        {
 0226            return new InvalidOperationException(message) { Source = ExceptionSourceValueToRethrowAsJsonException };
 0227        }
 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
 0318        {
 0319            throw GetInvalidOperationException(SR.Format(SR.CannotMixEncodings, GetEncodingName(previousEncoding), GetEn
 320
 321            static string GetEncodingName(EnclosingContainerType encoding)
 0322            {
 0323                switch (encoding)
 324                {
 0325                    case EnclosingContainerType.Utf8StringSequence: return "UTF-8";
 0326                    case EnclosingContainerType.Utf16StringSequence: return "UTF-16";
 0327                    case EnclosingContainerType.Base64StringSequence: return "Base64";
 328                    default:
 0329                        Debug.Fail("Unknown encoding.");
 330                        return "Unknown";
 331                };
 0332            }
 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 =
 4734371        {
 4734372            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
 4734377        {
 4734378            string message = GetResourceString(ref json, resource, nextByte, Encoding.UTF8.GetString(bytes));
 379
 4734380            long lineNumber = json.CurrentState._lineNumber;
 4734381            long bytePositionInLine = json.CurrentState._bytePositionInLine;
 382
 4734383            message += $" LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
 4734384            return new JsonReaderException(message, lineNumber, bytePositionInLine);
 4734385        }
 386
 4734387        private static bool IsPrintable(byte value) => value is >= 0x20 and < 0x7F;
 388
 389        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 390        internal static string GetPrintableString(byte value)
 4734391        {
 4734392            return IsPrintable(value) ? ((char)value).ToString() : $"0x{value:X2}";
 4734393        }
 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
 4734398        {
 4734399            string character = GetPrintableString(nextByte);
 400
 4734401            string message = "";
 4734402            switch (resource)
 403            {
 404                case ExceptionResource.ArrayDepthTooLarge:
 29405                    message = SR.Format(SR.ArrayDepthTooLarge, json.CurrentState.Options.MaxDepth);
 29406                    break;
 407                case ExceptionResource.MismatchedObjectArray:
 51408                    message = SR.Format(SR.MismatchedObjectArray, character);
 51409                    break;
 410                case ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd:
 24411                    message = SR.TrailingCommaNotAllowedBeforeArrayEnd;
 24412                    break;
 413                case ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd:
 9414                    message = SR.TrailingCommaNotAllowedBeforeObjectEnd;
 9415                    break;
 416                case ExceptionResource.EndOfStringNotFound:
 333417                    message = SR.EndOfStringNotFound;
 333418                    break;
 419                case ExceptionResource.RequiredDigitNotFoundAfterSign:
 138420                    message = SR.Format(SR.RequiredDigitNotFoundAfterSign, character);
 138421                    break;
 422                case ExceptionResource.RequiredDigitNotFoundAfterDecimal:
 75423                    message = SR.Format(SR.RequiredDigitNotFoundAfterDecimal, character);
 75424                    break;
 425                case ExceptionResource.RequiredDigitNotFoundEndOfData:
 41426                    message = SR.RequiredDigitNotFoundEndOfData;
 41427                    break;
 428                case ExceptionResource.ExpectedEndAfterSingleJson:
 168429                    message = SR.Format(SR.ExpectedEndAfterSingleJson, character);
 168430                    break;
 431                case ExceptionResource.ExpectedEndOfDigitNotFound:
 475432                    message = SR.Format(SR.ExpectedEndOfDigitNotFound, character);
 475433                    break;
 434                case ExceptionResource.ExpectedNextDigitEValueNotFound:
 79435                    message = SR.Format(SR.ExpectedNextDigitEValueNotFound, character);
 79436                    break;
 437                case ExceptionResource.ExpectedSeparatorAfterPropertyNameNotFound:
 41438                    message = SR.Format(SR.ExpectedSeparatorAfterPropertyNameNotFound, character);
 41439                    break;
 440                case ExceptionResource.ExpectedStartOfPropertyNotFound:
 146441                    message = SR.Format(SR.ExpectedStartOfPropertyNotFound, character);
 146442                    break;
 443                case ExceptionResource.ExpectedStartOfPropertyOrValueNotFound:
 108444                    message = SR.ExpectedStartOfPropertyOrValueNotFound;
 108445                    break;
 446                case ExceptionResource.ExpectedStartOfPropertyOrValueAfterComment:
 0447                    message = SR.Format(SR.ExpectedStartOfPropertyOrValueAfterComment, character);
 0448                    break;
 449                case ExceptionResource.ExpectedStartOfValueNotFound:
 1139450                    message = SR.Format(SR.ExpectedStartOfValueNotFound, character);
 1139451                    break;
 452                case ExceptionResource.ExpectedValueAfterPropertyNameNotFound:
 3453                    message = SR.ExpectedValueAfterPropertyNameNotFound;
 3454                    break;
 455                case ExceptionResource.FoundInvalidCharacter:
 335456                    message = SR.Format(SR.FoundInvalidCharacter, character);
 335457                    break;
 458                case ExceptionResource.InvalidEndOfJsonNonPrimitive:
 0459                    message = SR.Format(SR.InvalidEndOfJsonNonPrimitive, json.TokenType);
 0460                    break;
 461                case ExceptionResource.ObjectDepthTooLarge:
 8462                    message = SR.Format(SR.ObjectDepthTooLarge, json.CurrentState.Options.MaxDepth);
 8463                    break;
 464                case ExceptionResource.ExpectedFalse:
 40465                    message = SR.Format(SR.ExpectedFalse, characters);
 40466                    break;
 467                case ExceptionResource.ExpectedNull:
 64468                    message = SR.Format(SR.ExpectedNull, characters);
 64469                    break;
 470                case ExceptionResource.ExpectedTrue:
 31471                    message = SR.Format(SR.ExpectedTrue, characters);
 31472                    break;
 473                case ExceptionResource.InvalidCharacterWithinString:
 134474                    message = SR.Format(SR.InvalidCharacterWithinString, character);
 134475                    break;
 476                case ExceptionResource.InvalidCharacterAfterEscapeWithinString:
 25477                    message = SR.Format(SR.InvalidCharacterAfterEscapeWithinString, character);
 25478                    break;
 479                case ExceptionResource.InvalidHexCharacterWithinString:
 84480                    message = SR.Format(SR.InvalidHexCharacterWithinString, character);
 84481                    break;
 482                case ExceptionResource.EndOfCommentNotFound:
 230483                    message = SR.EndOfCommentNotFound;
 230484                    break;
 485                case ExceptionResource.ZeroDepthAtEnd:
 466486                    message = SR.ZeroDepthAtEnd;
 466487                    break;
 488                case ExceptionResource.ExpectedJsonTokens:
 404489                    message = SR.ExpectedJsonTokens;
 404490                    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:
 48504                    message = SR.UnexpectedEndOfLineSeparator;
 48505                    break;
 506                case ExceptionResource.InvalidLeadingZeroInNumber:
 6507                    message = SR.Format(SR.InvalidLeadingZeroInNumber, character);
 6508                    break;
 509                default:
 0510                    Debug.Fail($"The ExceptionResource enum value: {resource} is not part of the switch. Add the appropr
 511                    break;
 512            }
 513
 4734514            return message;
 4734515        }
 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}

D:\runner\runtime\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}

D:\runner\runtime\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_MetadataDuplicateIdFound(string id)
 0785        {
 0786            ThrowJsonException(SR.Format(SR.MetadataDuplicateIdFound, id));
 787        }
 788
 789        [DoesNotReturn]
 790        public static void ThrowJsonException_DuplicateMetadataProperty(ReadOnlySpan<byte> utf8PropertyName)
 0791        {
 0792            ThrowJsonException(SR.Format(SR.DuplicateMetadataProperty, Encoding.UTF8.GetString(utf8PropertyName)));
 793        }
 794
 795        [DoesNotReturn]
 796        public static void ThrowJsonException_MetadataInvalidReferenceToValueType(Type propertyType)
 0797        {
 0798            ThrowJsonException(SR.Format(SR.MetadataInvalidReferenceToValueType, propertyType));
 799        }
 800
 801        [DoesNotReturn]
 802        public static void ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(scoped ref ReadStack state, Type pr
 0803        {
 0804            state.Current.JsonPropertyName = reader.HasValueSequence ? reader.ValueSequence.ToArray() : reader.ValueSpan
 0805            string propertyNameAsString = reader.GetString()!;
 806
 0807            ThrowJsonException(SR.Format(SR.MetadataPreservedArrayFailed,
 0808                SR.Format(SR.MetadataInvalidPropertyInArrayMetadata, propertyNameAsString),
 0809                SR.Format(SR.DeserializeUnableToConvertValue, propertyType)));
 810        }
 811
 812        [DoesNotReturn]
 813        public static void ThrowJsonException_MetadataPreservedArrayValuesNotFound(scoped ref ReadStack state, Type prop
 0814        {
 815            // Missing $values, JSON path should point to the property's object.
 0816            state.Current.JsonPropertyName = null;
 817
 0818            ThrowJsonException(SR.Format(SR.MetadataPreservedArrayFailed,
 0819                SR.MetadataStandaloneValuesProperty,
 0820                SR.Format(SR.DeserializeUnableToConvertValue, propertyType)));
 821        }
 822
 823        [DoesNotReturn]
 824        public static void ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(Type propertyType)
 0825        {
 0826            ThrowJsonException(SR.Format(SR.MetadataCannotParsePreservedObjectToImmutable, propertyType));
 827        }
 828
 829        [DoesNotReturn]
 830        public static void ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(string reference
 0831        {
 0832            throw new InvalidOperationException(SR.Format(SR.MetadataReferenceOfTypeCannotBeAssignedToType, referenceId,
 833        }
 834
 835        [DoesNotReturn]
 836        public static void ThrowInvalidOperationException_JsonPropertyInfoIsBoundToDifferentJsonTypeInfo(JsonPropertyInf
 0837        {
 0838            Debug.Assert(propertyInfo.DeclaringTypeInfo is not null, "We should not throw this exception when ParentType
 0839            throw new InvalidOperationException(SR.Format(SR.JsonPropertyInfoBoundToDifferentParent, propertyInfo.Name, 
 840        }
 841
 842        [DoesNotReturn]
 843        public static void ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
 0844        {
 0845            throw new NotSupportedException(SR.Format(SR.NoMetadataForType, type, resolver?.ToString() ?? "<null>"));
 846        }
 847
 848        public static NotSupportedException GetNotSupportedException_AmbiguousMetadataForType(Type type, Type match1, Ty
 0849        {
 0850            return new NotSupportedException(SR.Format(SR.AmbiguousMetadataForType, type, match1, match2));
 0851        }
 852
 853        [DoesNotReturn]
 854        public static void ThrowNotSupportedException_ConstructorContainsNullParameterNames(Type declaringType)
 0855        {
 0856            throw new NotSupportedException(SR.Format(SR.ConstructorContainsNullParameterNames, declaringType));
 857        }
 858
 859        [DoesNotReturn]
 860        public static void ThrowInvalidOperationException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
 0861        {
 0862            throw new InvalidOperationException(SR.Format(SR.NoMetadataForType, type, resolver?.ToString() ?? "<null>"))
 863        }
 864
 865        public static Exception GetInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver
 0866        {
 0867            return new InvalidOperationException(SR.Format(SR.NoMetadataForTypeProperties, resolver?.ToString() ?? "<nul
 0868        }
 869
 870        [DoesNotReturn]
 871        public static void ThrowInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, T
 0872        {
 0873            throw GetInvalidOperationException_NoMetadataForTypeProperties(resolver, type);
 874        }
 875
 876        [DoesNotReturn]
 877        public static void ThrowMissingMemberException_MissingFSharpCoreMember(string missingFsharpCoreMember)
 0878        {
 0879            throw new MissingMemberException(SR.Format(SR.MissingFSharpCoreMember, missingFsharpCoreMember));
 880        }
 881
 882        [DoesNotReturn]
 883        public static void ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(Type derivedType)
 0884        {
 0885            throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedTyp
 886        }
 887
 888        [DoesNotReturn]
 889        public static void ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(Type derivedType)
 0890        {
 0891            throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedTyp
 892        }
 893
 894        [DoesNotReturn]
 895        public static void ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
 0896        {
 0897            throw new NotSupportedException(SR.Format(SR.Polymorphism_RuntimeTypeNotSupported, runtimeType, baseType));
 898        }
 899
 900        [DoesNotReturn]
 901        public static void ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(Type baseType, Type runtimeType, Type 
 0902        {
 0903            throw new NotSupportedException(SR.Format(SR.Polymorphism_RuntimeTypeDiamondAmbiguity, runtimeType, derivedT
 904        }
 905
 906        [DoesNotReturn]
 907        public static void ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(Type baseType)
 0908        {
 0909            throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDoesNotSupportPolymorphism, baseType));
 910        }
 911
 912        [DoesNotReturn]
 913        public static void ThrowInvalidOperationException_DerivedTypeNotSupported(Type baseType, Type derivedType)
 0914        {
 0915            throw new InvalidOperationException(SR.Format(SR.Polymorphism_DerivedTypeIsNotSupported, derivedType, baseTy
 916        }
 917
 918        [DoesNotReturn]
 919        public static void ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)
 0920        {
 0921            throw new InvalidOperationException(SR.Format(SR.Polymorphism_DerivedTypeIsAlreadySpecified, baseType, deriv
 922        }
 923
 924        [DoesNotReturn]
 925        public static void ThrowInvalidOperationException_OpenGenericDerivedTypeCouldNotBeResolved(Type baseType, Type d
 0926        {
 0927            throw new InvalidOperationException(SR.Format(SR.Polymorphism_OpenGenericDerivedTypeCouldNotBeResolved, deri
 928        }
 929
 930        [DoesNotReturn]
 931        public static void ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(Type baseType, object typ
 0932        {
 0933            throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDicriminatorIdIsAlreadySpecified, baseType
 934        }
 935
 936        [DoesNotReturn]
 937        public static void ThrowInvalidOperationException_InferredDerivedTypeIsNotAccessible(Type baseType, Type derived
 0938        {
 0939            throw new InvalidOperationException(SR.Format(SR.Polymorphism_InferredDerivedTypeIsNotAccessible, derivedTyp
 940        }
 941
 942        [DoesNotReturn]
 943        public static void ThrowInvalidOperationException_InferClosedTypePolymorphismOnNonClosedType(Type baseType)
 0944        {
 0945            throw new InvalidOperationException(SR.Format(SR.Polymorphism_InferClosedTypePolymorphismOnNonClosedType, ba
 946        }
 947
 948        [DoesNotReturn]
 949        public static void ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName()
 0950        {
 0951            throw new InvalidOperationException(SR.Polymorphism_InvalidCustomTypeDiscriminatorPropertyName);
 952        }
 953
 954        [DoesNotReturn]
 955        public static void ThrowInvalidOperationException_PropertyConflictsWithMetadataPropertyName(Type type, string pr
 0956        {
 0957            throw new InvalidOperationException(SR.Format(SR.Polymorphism_PropertyConflictsWithMetadataPropertyName, typ
 958        }
 959
 960        [DoesNotReturn]
 961        public static void ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(Type ba
 0962        {
 0963            throw new InvalidOperationException(SR.Format(SR.Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes, baseT
 964        }
 965
 966        [DoesNotReturn]
 967        public static void ThrowJsonException_UnionDoesNotAcceptNull(Type unionType)
 0968        {
 0969            ThrowJsonException(SR.Format(SR.UnionDoesNotAcceptNull, unionType));
 970        }
 971
 972        [DoesNotReturn]
 973        public static void ThrowJsonException_UnionRuntimeTypeNotMatchedToCase(Type unionType, Type runtimeType)
 0974        {
 0975            ThrowJsonException(SR.Format(SR.UnionRuntimeTypeNotMatchedToCase, runtimeType, unionType));
 976        }
 977
 978        [DoesNotReturn]
 979        public static void ThrowJsonException_UnionCannotCreateValue(Type unionType)
 0980        {
 0981            ThrowJsonException(SR.Format(SR.UnionCannotCreateValue, unionType));
 982        }
 983
 984        [DoesNotReturn]
 985        public static void ThrowJsonException_UnionCannotReadValue(Type unionType)
 0986        {
 0987            ThrowJsonException(SR.Format(SR.UnionCannotReadValue, unionType));
 988        }
 989
 990        [DoesNotReturn]
 991        public static void ThrowJsonException_UnionTypeClassifierReturnedNull(Type unionType, JsonTokenType tokenType)
 0992        {
 0993            ThrowJsonException(SR.Format(SR.UnionTypeClassifierReturnedNull, unionType, tokenType));
 994        }
 995
 996        [DoesNotReturn]
 997        public static void ThrowJsonException_UnionAmbiguousJsonValueType(Type unionType, JsonValueType valueType)
 0998        {
 0999            ThrowJsonException(SR.Format(SR.UnionAmbiguousJsonValueType, valueType, unionType));
 1000        }
 1001
 1002        [DoesNotReturn]
 1003        public static void ThrowJsonException_UnionJsonTokenTypeNotSupported(Type unionType, JsonTokenType tokenType)
 01004        {
 01005            ThrowJsonException(SR.Format(SR.UnionJsonTokenTypeNotSupported, tokenType, unionType));
 1006        }
 1007
 1008        [DoesNotReturn]
 1009        public static void ThrowInvalidOperationException_UnionCasesNotPopulated(Type unionType)
 01010        {
 01011            throw new InvalidOperationException(SR.Format(SR.UnionCasesNotPopulated, unionType));
 1012        }
 1013
 1014        [DoesNotReturn]
 1015        public static void ThrowInvalidOperationException_UnionCannotCreateValue(Type unionType)
 01016        {
 01017            throw new InvalidOperationException(SR.Format(SR.UnionCannotCreateValue, unionType));
 1018        }
 1019
 1020        [DoesNotReturn]
 1021        public static void ThrowInvalidOperationException_UnionCannotReadValue(Type unionType)
 01022        {
 01023            throw new InvalidOperationException(SR.Format(SR.UnionCannotReadValue, unionType));
 1024        }
 1025
 1026        [DoesNotReturn]
 1027        public static void ThrowInvalidOperationException_UnionTypeStructuralClassifierOnlyForUnions(Type unionType)
 01028        {
 01029            throw new InvalidOperationException(SR.Format(SR.UnionTypeStructuralClassifierOnlyForUnions, unionType));
 1030        }
 1031
 1032        [DoesNotReturn]
 1033        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierCaseNotSupported(
 1034            Type unionType,
 1035            Type caseType)
 01036        {
 01037            throw new NotSupportedException(
 01038                SR.Format(
 01039                    SR.UnionTypeStructuralClassifierCaseNotSupported,
 01040                    unionType,
 01041                    caseType));
 1042        }
 1043
 1044        [DoesNotReturn]
 1045        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierPreserveReferencesNotSupported(Type u
 01046        {
 01047            throw new NotSupportedException(
 01048                SR.Format(
 01049                    SR.UnionTypeStructuralClassifierPreserveReferencesNotSupported,
 01050                    unionType));
 1051        }
 1052
 1053        [DoesNotReturn]
 1054        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierAmbiguousCases(
 1055            Type unionType,
 1056            Type conflictingCaseType,
 1057            Type caseType,
 1058            JsonValueType valueType)
 01059        {
 01060            throw new NotSupportedException(
 01061                SR.Format(
 01062                    SR.UnionTypeStructuralClassifierAmbiguousCases,
 01063                    unionType,
 01064                    conflictingCaseType,
 01065                    caseType,
 01066                    valueType));
 1067        }
 1068
 1069        [DoesNotReturn]
 1070        public static void ThrowNotSupportedException_UnionTypeStructuralClassifierUnreachableObjectCase(
 1071            Type unionType,
 1072            Type unreachableCaseType,
 1073            Type shadowingCaseType)
 01074        {
 01075            throw new NotSupportedException(
 01076                SR.Format(
 01077                    SR.UnionTypeStructuralClassifierUnreachableObjectCase,
 01078                    unionType,
 01079                    unreachableCaseType,
 01080                    shadowingCaseType));
 1081        }
 1082
 1083        [DoesNotReturn]
 1084        public static void ThrowInvalidOperationException_TypeClassifierMustDeriveFromJsonTypeClassifierFactory(Type cla
 01085        {
 01086            throw new InvalidOperationException(SR.Format(SR.TypeClassifierMustDeriveFromJsonTypeClassifierFactory, clas
 1087        }
 1088
 1089        [DoesNotReturn]
 1090        public static void ThrowInvalidOperationException_TypeClassifierNotSupported(Type classifierType, Type type)
 01091        {
 01092            throw new InvalidOperationException(SR.Format(SR.TypeClassifierNotSupported, classifierType, type));
 1093        }
 1094
 1095        [DoesNotReturn]
 1096        public static void ThrowInvalidOperationException_UnsupportedEnumIdentifier(Type enumType, string? enumName)
 01097        {
 01098            throw new InvalidOperationException(SR.Format(SR.UnsupportedEnumIdentifier, enumType.Name, enumName));
 1099        }
 1100
 1101        [DoesNotReturn]
 1102        public static void ThrowJsonException_UnrecognizedTypeDiscriminator(object typeDiscriminator)
 01103        {
 01104            ThrowJsonException(SR.Format(SR.Polymorphism_UnrecognizedTypeDiscriminator, typeDiscriminator));
 1105        }
 1106
 1107        [DoesNotReturn]
 1108        public static void ThrowArgumentException_JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo(string para
 01109        {
 01110            throw new ArgumentException(SR.JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo, paramName: parame
 1111        }
 1112
 1113        [DoesNotReturn]
 1114        public static void ThrowOperationCanceledException_PipeWriteCanceled()
 01115        {
 01116            throw new OperationCanceledException(SR.PipeWriterCanceled);
 1117        }
 1118
 1119        [DoesNotReturn]
 1120        public static void ThrowOperationCanceledException_PipeReadCanceled()
 01121        {
 01122            throw new OperationCanceledException(SR.PipeReaderCanceled);
 1123        }
 1124
 1125        [DoesNotReturn]
 1126        public static void ThrowInvalidOperationException_PipeWriterDoesNotImplementUnflushedBytes(PipeWriter pipeWriter
 01127        {
 01128            throw new InvalidOperationException(SR.Format(SR.PipeWriter_DoesNotImplementUnflushedBytes, pipeWriter.GetTy
 1129        }
 1130
 1131        [DoesNotReturn]
 1132        public static void ThrowNotSupportedException_JsonSchemaExporterDoesNotSupportReferenceHandlerPreserve()
 01133        {
 01134            throw new NotSupportedException(SR.JsonSchemaExporter_ReferenceHandlerPreserve_NotSupported);
 1135        }
 1136
 1137        [DoesNotReturn]
 1138        public static void ThrowInvalidOperationException_JsonSchemaExporterDepthTooLarge()
 01139        {
 01140            throw new InvalidOperationException(SR.JsonSchemaExporter_DepthTooLarge);
 1141        }
 1142    }
 1143}

Methods/Properties

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_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)
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()