< Summary

Line coverage
20%
Covered lines: 160
Uncovered lines: 638
Coverable lines: 798
Total lines: 1950
Line coverage: 20%
Branch coverage
25%
Covered branches: 50
Total branches: 199
Branch coverage: 25.1%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\Common\ThrowHelper.cs

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

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\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)
 12002225        {
 12002226            return new InvalidOperationException(message) { Source = ExceptionSourceValueToRethrowAsJsonException };
 12002227        }
 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)
 454264        {
 454265            return GetInvalidOperationException("array", tokenType);
 454266        }
 267
 268        public static InvalidOperationException GetInvalidOperationException_ExpectedObject(JsonTokenType tokenType)
 586269        {
 586270            return GetInvalidOperationException("object", tokenType);
 586271        }
 272
 273        [DoesNotReturn]
 274        public static void ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
 5428275        {
 5428276            throw GetInvalidOperationException("number", tokenType);
 277        }
 278
 279        [DoesNotReturn]
 280        public static void ThrowInvalidOperationException_ExpectedBoolean(JsonTokenType tokenType)
 644281        {
 644282            throw GetInvalidOperationException("boolean", tokenType);
 283        }
 284
 285        [DoesNotReturn]
 286        public static void ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
 4696287        {
 4696288            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)
 12002336        {
 12002337            return GetInvalidOperationException(SR.Format(SR.InvalidCast, tokenType, message));
 12002338        }
 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 =
 36484371        {
 36484372            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
 36988377        {
 36988378            string message = GetResourceString(ref json, resource, nextByte, Encoding.UTF8.GetString(bytes));
 379
 36988380            long lineNumber = json.CurrentState._lineNumber;
 36988381            long bytePositionInLine = json.CurrentState._bytePositionInLine;
 382
 36988383            message += $" LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
 36988384            return new JsonReaderException(message, lineNumber, bytePositionInLine);
 36988385        }
 386
 36988387        private static bool IsPrintable(byte value) => value >= 0x20 && value < 0x7F;
 388
 389        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 390        internal static string GetPrintableString(byte value)
 36988391        {
 36988392            return IsPrintable(value) ? ((char)value).ToString() : $"0x{value:X2}";
 36988393        }
 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
 36988398        {
 36988399            string character = GetPrintableString(nextByte);
 400
 36988401            string message = "";
 36988402            switch (resource)
 403            {
 404                case ExceptionResource.ArrayDepthTooLarge:
 0405                    message = SR.Format(SR.ArrayDepthTooLarge, json.CurrentState.Options.MaxDepth);
 0406                    break;
 407                case ExceptionResource.MismatchedObjectArray:
 0408                    message = SR.Format(SR.MismatchedObjectArray, character);
 0409                    break;
 410                case ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd:
 0411                    message = SR.TrailingCommaNotAllowedBeforeArrayEnd;
 0412                    break;
 413                case ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd:
 0414                    message = SR.TrailingCommaNotAllowedBeforeObjectEnd;
 0415                    break;
 416                case ExceptionResource.EndOfStringNotFound:
 336417                    message = SR.EndOfStringNotFound;
 336418                    break;
 419                case ExceptionResource.RequiredDigitNotFoundAfterSign:
 410420                    message = SR.Format(SR.RequiredDigitNotFoundAfterSign, character);
 410421                    break;
 422                case ExceptionResource.RequiredDigitNotFoundAfterDecimal:
 84423                    message = SR.Format(SR.RequiredDigitNotFoundAfterDecimal, character);
 84424                    break;
 425                case ExceptionResource.RequiredDigitNotFoundEndOfData:
 0426                    message = SR.RequiredDigitNotFoundEndOfData;
 0427                    break;
 428                case ExceptionResource.ExpectedEndAfterSingleJson:
 3684429                    message = SR.Format(SR.ExpectedEndAfterSingleJson, character);
 3684430                    break;
 431                case ExceptionResource.ExpectedEndOfDigitNotFound:
 1590432                    message = SR.Format(SR.ExpectedEndOfDigitNotFound, character);
 1590433                    break;
 434                case ExceptionResource.ExpectedNextDigitEValueNotFound:
 252435                    message = SR.Format(SR.ExpectedNextDigitEValueNotFound, character);
 252436                    break;
 437                case ExceptionResource.ExpectedSeparatorAfterPropertyNameNotFound:
 0438                    message = SR.Format(SR.ExpectedSeparatorAfterPropertyNameNotFound, character);
 0439                    break;
 440                case ExceptionResource.ExpectedStartOfPropertyNotFound:
 408441                    message = SR.Format(SR.ExpectedStartOfPropertyNotFound, character);
 408442                    break;
 443                case ExceptionResource.ExpectedStartOfPropertyOrValueNotFound:
 0444                    message = SR.ExpectedStartOfPropertyOrValueNotFound;
 0445                    break;
 446                case ExceptionResource.ExpectedStartOfPropertyOrValueAfterComment:
 0447                    message = SR.Format(SR.ExpectedStartOfPropertyOrValueAfterComment, character);
 0448                    break;
 449                case ExceptionResource.ExpectedStartOfValueNotFound:
 27115450                    message = SR.Format(SR.ExpectedStartOfValueNotFound, character);
 27115451                    break;
 452                case ExceptionResource.ExpectedValueAfterPropertyNameNotFound:
 0453                    message = SR.ExpectedValueAfterPropertyNameNotFound;
 0454                    break;
 455                case ExceptionResource.FoundInvalidCharacter:
 38456                    message = SR.Format(SR.FoundInvalidCharacter, character);
 38457                    break;
 458                case ExceptionResource.InvalidEndOfJsonNonPrimitive:
 0459                    message = SR.Format(SR.InvalidEndOfJsonNonPrimitive, json.TokenType);
 0460                    break;
 461                case ExceptionResource.ObjectDepthTooLarge:
 0462                    message = SR.Format(SR.ObjectDepthTooLarge, json.CurrentState.Options.MaxDepth);
 0463                    break;
 464                case ExceptionResource.ExpectedFalse:
 420465                    message = SR.Format(SR.ExpectedFalse, characters);
 420466                    break;
 467                case ExceptionResource.ExpectedNull:
 336468                    message = SR.Format(SR.ExpectedNull, characters);
 336469                    break;
 470                case ExceptionResource.ExpectedTrue:
 252471                    message = SR.Format(SR.ExpectedTrue, characters);
 252472                    break;
 473                case ExceptionResource.InvalidCharacterWithinString:
 468474                    message = SR.Format(SR.InvalidCharacterWithinString, character);
 468475                    break;
 476                case ExceptionResource.InvalidCharacterAfterEscapeWithinString:
 0477                    message = SR.Format(SR.InvalidCharacterAfterEscapeWithinString, character);
 0478                    break;
 479                case ExceptionResource.InvalidHexCharacterWithinString:
 0480                    message = SR.Format(SR.InvalidHexCharacterWithinString, character);
 0481                    break;
 482                case ExceptionResource.EndOfCommentNotFound:
 0483                    message = SR.EndOfCommentNotFound;
 0484                    break;
 485                case ExceptionResource.ZeroDepthAtEnd:
 0486                    message = SR.ZeroDepthAtEnd;
 0487                    break;
 488                case ExceptionResource.ExpectedJsonTokens:
 738489                    message = SR.ExpectedJsonTokens;
 738490                    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:
 589498                    message = SR.Format(SR.InvalidCharacterAtStartOfComment, character);
 589499                    break;
 500                case ExceptionResource.UnexpectedEndOfDataWhileReadingComment:
 0501                    message = SR.UnexpectedEndOfDataWhileReadingComment;
 0502                    break;
 503                case ExceptionResource.UnexpectedEndOfLineSeparator:
 0504                    message = SR.UnexpectedEndOfLineSeparator;
 0505                    break;
 506                case ExceptionResource.InvalidLeadingZeroInNumber:
 268507                    message = SR.Format(SR.InvalidLeadingZeroInNumber, character);
 268508                    break;
 509                default:
 0510                    Debug.Fail($"The ExceptionResource enum value: {resource} is not part of the switch. Add the appropr
 511                    break;
 512            }
 513
 36988514            return message;
 36988515        }
 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
 972576        {
 972577            return GetInvalidOperationException(SR.CannotTranscodeInvalidUtf8, innerException);
 972578        }
 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)
 972586        {
 972587            InvalidOperationException ex = new InvalidOperationException(message, innerException);
 972588            ex.Source = ExceptionSourceValueToRethrowAsJsonException;
 972589            return ex;
 972590        }
 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 == JsonConstants.CloseBracket || token == 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        public static void ThrowFormatException(NumericType numericType)
 2316658        {
 2316659            string message = "";
 660
 2316661            switch (numericType)
 662            {
 663                case NumericType.Byte:
 234664                    message = SR.FormatByte;
 234665                    break;
 666                case NumericType.SByte:
 208667                    message = SR.FormatSByte;
 208668                    break;
 669                case NumericType.Int16:
 198670                    message = SR.FormatInt16;
 198671                    break;
 672                case NumericType.Int32:
 266673                    message = SR.FormatInt32;
 266674                    break;
 675                case NumericType.Int64:
 146676                    message = SR.FormatInt64;
 146677                    break;
 678                case NumericType.Int128:
 94679                    message = SR.FormatInt128;
 94680                    break;
 681                case NumericType.UInt16:
 194682                    message = SR.FormatUInt16;
 194683                    break;
 684                case NumericType.UInt32:
 184685                    message = SR.FormatUInt32;
 184686                    break;
 687                case NumericType.UInt64:
 144688                    message = SR.FormatUInt64;
 144689                    break;
 690                case NumericType.UInt128:
 90691                    message = SR.FormatUInt128;
 90692                    break;
 693                case NumericType.Half:
 142694                    message = SR.FormatHalf;
 142695                    break;
 696                case NumericType.Single:
 128697                    message = SR.FormatSingle;
 128698                    break;
 699                case NumericType.Double:
 148700                    message = SR.FormatDouble;
 148701                    break;
 702                case NumericType.Decimal:
 140703                    message = SR.FormatDecimal;
 140704                    break;
 705                default:
 0706                    Debug.Fail($"The NumericType enum value: {numericType} is not part of the switch. Add the appropriat
 707                    break;
 708            }
 709
 2316710            throw new FormatException(message) { Source = ExceptionSourceValueToRethrowAsJsonException };
 711        }
 712
 713        [DoesNotReturn]
 714        public static void ThrowFormatException(DataType dataType)
 2338715        {
 2338716            string message = "";
 717
 2338718            switch (dataType)
 719            {
 720                case DataType.Boolean:
 721                case DataType.DateOnly:
 722                case DataType.DateTime:
 723                case DataType.DateTimeOffset:
 724                case DataType.TimeOnly:
 725                case DataType.TimeSpan:
 726                case DataType.Guid:
 727                case DataType.Version:
 1864728                    message = SR.Format(SR.UnsupportedFormat, dataType);
 1864729                    break;
 730                case DataType.Base64String:
 474731                    message = SR.CannotDecodeInvalidBase64;
 474732                    break;
 733                default:
 0734                    Debug.Fail($"The DataType enum value: {dataType} is not part of the switch. Add the appropriate case
 735                    break;
 736            }
 737
 2338738            throw new FormatException(message) { Source = ExceptionSourceValueToRethrowAsJsonException };
 739        }
 740
 741        [DoesNotReturn]
 742        public static void ThrowInvalidOperationException_ExpectedChar(JsonTokenType tokenType)
 194743        {
 194744            throw GetInvalidOperationException("char", tokenType);
 745        }
 746
 747        [DoesNotReturn]
 748        public static void ThrowObjectDisposedException_Utf8JsonWriter()
 0749        {
 0750            throw new ObjectDisposedException(nameof(Utf8JsonWriter));
 751        }
 752
 753        [DoesNotReturn]
 754        public static void ThrowObjectDisposedException_JsonDocument()
 0755        {
 0756            throw new ObjectDisposedException(nameof(JsonDocument));
 757        }
 758
 759        [DoesNotReturn]
 760        public static void ThrowInsufficientExecutionStackException_JsonElementDeepEqualsInsufficientExecutionStack()
 0761        {
 0762            throw new InsufficientExecutionStackException(SR.JsonElementDeepEqualsInsufficientExecutionStack);
 763        }
 764    }
 765
 766    internal enum ExceptionResource
 767    {
 768        ArrayDepthTooLarge,
 769        EndOfCommentNotFound,
 770        EndOfStringNotFound,
 771        RequiredDigitNotFoundAfterDecimal,
 772        RequiredDigitNotFoundAfterSign,
 773        RequiredDigitNotFoundEndOfData,
 774        ExpectedEndAfterSingleJson,
 775        ExpectedEndOfDigitNotFound,
 776        ExpectedFalse,
 777        ExpectedNextDigitEValueNotFound,
 778        ExpectedNull,
 779        ExpectedSeparatorAfterPropertyNameNotFound,
 780        ExpectedStartOfPropertyNotFound,
 781        ExpectedStartOfPropertyOrValueNotFound,
 782        ExpectedStartOfPropertyOrValueAfterComment,
 783        ExpectedStartOfValueNotFound,
 784        ExpectedTrue,
 785        ExpectedValueAfterPropertyNameNotFound,
 786        FoundInvalidCharacter,
 787        InvalidCharacterWithinString,
 788        InvalidCharacterAfterEscapeWithinString,
 789        InvalidHexCharacterWithinString,
 790        InvalidEndOfJsonNonPrimitive,
 791        MismatchedObjectArray,
 792        ObjectDepthTooLarge,
 793        ZeroDepthAtEnd,
 794        DepthTooLarge,
 795        CannotStartObjectArrayWithoutProperty,
 796        CannotStartObjectArrayAfterPrimitiveOrClose,
 797        CannotWriteValueWithinObject,
 798        CannotWriteValueAfterPrimitiveOrClose,
 799        CannotWritePropertyWithinArray,
 800        ExpectedJsonTokens,
 801        TrailingCommaNotAllowedBeforeArrayEnd,
 802        TrailingCommaNotAllowedBeforeObjectEnd,
 803        InvalidCharacterAtStartOfComment,
 804        UnexpectedEndOfDataWhileReadingComment,
 805        UnexpectedEndOfLineSeparator,
 806        ExpectedOneCompleteToken,
 807        NotEnoughData,
 808        InvalidLeadingZeroInNumber,
 809        CannotWriteWithinString,
 810    }
 811
 812    internal enum NumericType
 813    {
 814        Byte,
 815        SByte,
 816        Int16,
 817        Int32,
 818        Int64,
 819        Int128,
 820        UInt16,
 821        UInt32,
 822        UInt64,
 823        UInt128,
 824        Half,
 825        Single,
 826        Double,
 827        Decimal
 828    }
 829
 830    internal enum DataType
 831    {
 832        Boolean,
 833        DateOnly,
 834        DateTime,
 835        DateTimeOffset,
 836        TimeOnly,
 837        TimeSpan,
 838        Base64String,
 839        Guid,
 840        Version,
 841    }
 842}

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\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()
 2245        {
 2246            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}

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\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)
 143451        {
 143452            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)
 1128147        {
 1128148            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 == null);
 0157                throw new ArgumentException(SR.Format(SR.CannotSerializeInvalidType, typeToConvert), paramName);
 158            }
 159
 0160            Debug.Assert(propertyName != 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_SerializerOptionsReadOnly(JsonSerializerContext? context)
 0234        {
 0235            string message = context == null
 0236                ? SR.SerializerOptionsReadOnly
 0237                : SR.SerializerContextOptionsReadOnly;
 238
 0239            throw new InvalidOperationException(message);
 240        }
 241
 242        [DoesNotReturn]
 243        public static void ThrowInvalidOperationException_DefaultTypeInfoResolverImmutable()
 0244        {
 0245            throw new InvalidOperationException(SR.DefaultTypeInfoResolverImmutable);
 246        }
 247
 248        [DoesNotReturn]
 249        public static void ThrowInvalidOperationException_TypeInfoResolverChainImmutable()
 0250        {
 0251            throw new InvalidOperationException(SR.TypeInfoResolverChainImmutable);
 252        }
 253
 254        [DoesNotReturn]
 255        public static void ThrowInvalidOperationException_TypeInfoImmutable()
 0256        {
 0257            throw new InvalidOperationException(SR.TypeInfoImmutable);
 258        }
 259
 260        [DoesNotReturn]
 261        public static void ThrowInvalidOperationException_InvalidChainedResolver()
 0262        {
 0263            throw new InvalidOperationException(SR.SerializerOptions_InvalidChainedResolver);
 264        }
 265
 266        [DoesNotReturn]
 267        public static void ThrowInvalidOperationException_SerializerPropertyNameConflict(Type type, string propertyName)
 0268        {
 0269            throw new InvalidOperationException(SR.Format(SR.SerializerPropertyNameConflict, type, propertyName));
 270        }
 271
 272        [DoesNotReturn]
 273        public static void ThrowInvalidOperationException_SerializerPropertyNameNull(JsonPropertyInfo jsonPropertyInfo)
 0274        {
 0275            throw new InvalidOperationException(SR.Format(SR.SerializerPropertyNameNull, jsonPropertyInfo.DeclaringType,
 276        }
 277
 278        [DoesNotReturn]
 279        public static void ThrowInvalidOperationException_JsonPropertyRequiredAndNotDeserializable(JsonPropertyInfo json
 0280        {
 0281            throw new InvalidOperationException(SR.Format(SR.JsonPropertyRequiredAndNotDeserializable, jsonPropertyInfo.
 282        }
 283
 284        [DoesNotReturn]
 285        public static void ThrowInvalidOperationException_JsonPropertyRequiredAndExtensionData(JsonPropertyInfo jsonProp
 0286        {
 0287            throw new InvalidOperationException(SR.Format(SR.JsonPropertyRequiredAndExtensionData, jsonPropertyInfo.Name
 288        }
 289
 290        [DoesNotReturn]
 291        public static void ThrowJsonException_JsonRequiredPropertyMissing(JsonTypeInfo parent, BitArray assignedOrNotReq
 0292        {
 0293            StringBuilder listOfMissingPropertiesBuilder = new();
 0294            bool first = true;
 295
 296            // Soft cut-off length - once message becomes longer than that we won't be adding more elements
 297            const int CutOffLength = 60;
 298
 0299            foreach (JsonPropertyInfo property in parent.PropertyCache)
 0300            {
 0301                if (assignedOrNotRequiredPropertiesSet[property.PropertyIndex])
 0302                {
 0303                    continue;
 304                }
 305
 0306                if (!first)
 0307                {
 0308                    listOfMissingPropertiesBuilder.Append(CultureInfo.CurrentUICulture.TextInfo.ListSeparator);
 0309                    listOfMissingPropertiesBuilder.Append(' ');
 0310                }
 311
 0312                listOfMissingPropertiesBuilder.Append('\'');
 0313                listOfMissingPropertiesBuilder.Append(property.Name);
 0314                listOfMissingPropertiesBuilder.Append('\'');
 0315                first = false;
 316
 0317                if (listOfMissingPropertiesBuilder.Length >= CutOffLength)
 0318                {
 0319                    break;
 320                }
 0321            }
 322
 0323            throw new JsonException(SR.Format(SR.JsonRequiredPropertiesMissing, parent.Type, listOfMissingPropertiesBuil
 324        }
 325
 326        [DoesNotReturn]
 327        public static void ThrowJsonException_DuplicatePropertyNotAllowed(JsonPropertyInfo property)
 0328        {
 0329            throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_JsonPropertyInfo, property.Name, property
 330        }
 331
 332        [DoesNotReturn]
 333        public static void ThrowJsonException_DuplicatePropertyNotAllowed()
 0334        {
 0335            throw new JsonException(SR.DuplicatePropertiesNotAllowed);
 336        }
 337
 338        [DoesNotReturn]
 339        public static void ThrowJsonException_DuplicatePropertyNotAllowed(string name)
 0340        {
 0341            throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_NameSpan, Truncate(name)));
 342        }
 343
 344        [DoesNotReturn]
 345        public static void ThrowJsonException_DuplicatePropertyNotAllowed(ReadOnlySpan<byte> nameBytes)
 0346        {
 0347            string name = Encoding.UTF8.GetString(nameBytes);
 0348            throw new JsonException(SR.Format(SR.DuplicatePropertiesNotAllowed_NameSpan, Truncate(name)));
 349        }
 350
 351        private static string Truncate(ReadOnlySpan<char> str)
 0352        {
 353            const int MaxLength = 15;
 354
 0355            if (str.Length <= MaxLength)
 0356            {
 0357                return str.ToString();
 358            }
 359
 0360            Span<char> builder = stackalloc char[MaxLength + 3];
 0361            str.Slice(0, MaxLength).CopyTo(builder);
 0362            builder[MaxLength] = builder[MaxLength + 1] = builder[MaxLength + 2] = '.';
 0363            return builder.ToString();
 0364        }
 365
 366        [DoesNotReturn]
 367        public static void ThrowInvalidOperationException_NamingPolicyReturnNull(JsonNamingPolicy namingPolicy)
 0368        {
 0369            throw new InvalidOperationException(SR.Format(SR.NamingPolicyReturnNull, namingPolicy));
 370        }
 371
 372        [DoesNotReturn]
 373        public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(Type converterType)
 0374        {
 0375            throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsNull, converterType));
 376        }
 377
 378        [DoesNotReturn]
 379        public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactory(Type con
 0380        {
 0381            throw new InvalidOperationException(SR.Format(SR.SerializerConverterFactoryReturnsJsonConverterFactory, conv
 382        }
 383
 384        [DoesNotReturn]
 385        public static void ThrowInvalidOperationException_MultiplePropertiesBindToConstructorParameters(
 386            Type parentType,
 387            string parameterName,
 388            string firstMatchName,
 389            string secondMatchName)
 0390        {
 0391            throw new InvalidOperationException(
 0392                SR.Format(
 0393                    SR.MultipleMembersBindWithConstructorParameter,
 0394                    firstMatchName,
 0395                    secondMatchName,
 0396                    parentType,
 0397                    parameterName));
 398        }
 399
 400        [DoesNotReturn]
 401        public static void ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
 0402        {
 0403            throw new InvalidOperationException(SR.Format(SR.ConstructorParamIncompleteBinding, parentType));
 404        }
 405
 406        [DoesNotReturn]
 407        public static void ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(string propertyName, JsonPr
 0408        {
 0409            throw new InvalidOperationException(SR.Format(SR.ExtensionDataCannotBindToCtorParam, propertyName, jsonPrope
 410        }
 411
 412        [DoesNotReturn]
 413        public static void ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(string memberName, Type decl
 0414        {
 0415            throw new InvalidOperationException(SR.Format(SR.JsonIncludeOnInaccessibleProperty, memberName, declaringTyp
 416        }
 417
 418        [DoesNotReturn]
 419        public static void ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(string clrPropertyName, Type
 0420        {
 0421            throw new InvalidOperationException(SR.Format(SR.IgnoreConditionOnValueTypeInvalid, clrPropertyName, propert
 422        }
 423
 424        [DoesNotReturn]
 425        public static void ThrowInvalidOperationException_NumberHandlingOnPropertyInvalid(JsonPropertyInfo jsonPropertyI
 0426        {
 0427            Debug.Assert(!jsonPropertyInfo.IsForTypeInfo);
 0428            throw new InvalidOperationException(SR.Format(SR.NumberHandlingOnPropertyInvalid, jsonPropertyInfo.MemberNam
 429        }
 430
 431        [DoesNotReturn]
 432        public static void ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(Type runtimePropertyType, Jso
 0433        {
 0434            throw new InvalidOperationException(SR.Format(SR.ConverterCanConvertMultipleTypes, jsonConverter.GetType(), 
 435        }
 436
 437        [DoesNotReturn]
 438        public static void ThrowNotSupportedException_ObjectWithParameterizedCtorRefMetadataNotSupported(
 439            ReadOnlySpan<byte> propertyName,
 440            ref Utf8JsonReader reader,
 441            scoped ref ReadStack state)
 0442        {
 0443            JsonTypeInfo jsonTypeInfo = state.GetTopJsonTypeInfoWithParameterizedConstructor();
 0444            state.Current.JsonPropertyName = propertyName.ToArray();
 445
 0446            NotSupportedException ex = new NotSupportedException(
 0447                SR.Format(SR.ObjectWithParameterizedCtorRefMetadataNotSupported, jsonTypeInfo.Type));
 0448            ThrowNotSupportedException(ref state, reader, ex);
 449        }
 450
 451        [DoesNotReturn]
 452        public static void ThrowInvalidOperationException_JsonTypeInfoOperationNotPossibleForKind(JsonTypeInfoKind kind)
 0453        {
 0454            throw new InvalidOperationException(SR.Format(SR.InvalidJsonTypeInfoOperationForKind, kind));
 455        }
 456
 457        [DoesNotReturn]
 458        public static void ThrowInvalidOperationException_JsonTypeInfoOnDeserializingCallbacksNotSupported(Type type)
 0459        {
 0460            throw new InvalidOperationException(SR.Format(SR.OnDeserializingCallbacksNotSupported, type));
 461        }
 462
 463        [DoesNotReturn]
 464        public static void ThrowInvalidOperationException_CreateObjectConverterNotCompatible(Type type)
 0465        {
 0466            throw new InvalidOperationException(SR.Format(SR.CreateObjectConverterNotCompatible, type));
 467        }
 468
 469        [DoesNotReturn]
 470        public static void ReThrowWithPath(scoped ref ReadStack state, JsonReaderException ex)
 35640471        {
 35640472            Debug.Assert(ex.Path == null);
 473
 35640474            string path = state.JsonPath();
 35640475            string message = ex.Message;
 476
 477            // Insert the "Path" portion before "LineNumber" and "BytePositionInLine".
 478#if NET
 35640479            int iPos = message.AsSpan().LastIndexOf(" LineNumber: ");
 480#else
 481            int iPos = message.LastIndexOf(" LineNumber: ", StringComparison.Ordinal);
 482#endif
 35640483            if (iPos >= 0)
 35640484            {
 35640485                message = $"{message.Substring(0, iPos)} Path: {path} |{message.Substring(iPos)}";
 35640486            }
 487            else
 0488            {
 0489                message += $" Path: {path}.";
 0490            }
 491
 35640492            throw new JsonException(message, path, ex.LineNumber, ex.BytePositionInLine, ex);
 493        }
 494
 495        [DoesNotReturn]
 496        public static void ReThrowWithPath(scoped ref ReadStack state, in Utf8JsonReader reader, Exception ex)
 17526497        {
 17526498            JsonException jsonException = new JsonException(null, ex);
 17526499            AddJsonExceptionInformation(ref state, reader, jsonException);
 17526500            throw jsonException;
 501        }
 502
 503        public static void AddJsonExceptionInformation(scoped ref ReadStack state, in Utf8JsonReader reader, JsonExcepti
 20088504        {
 20088505            Debug.Assert(ex.Path is null); // do not overwrite existing path information
 506
 20088507            long lineNumber = reader.CurrentState._lineNumber;
 20088508            ex.LineNumber = lineNumber;
 509
 20088510            long bytePositionInLine = reader.CurrentState._bytePositionInLine;
 20088511            ex.BytePositionInLine = bytePositionInLine;
 512
 20088513            string path = state.JsonPath();
 20088514            ex.Path = path;
 515
 20088516            string? message = ex._message;
 517
 20088518            if (string.IsNullOrEmpty(message))
 18654519            {
 520                // Use a default message.
 18654521                Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
 18654522                message = SR.Format(SR.DeserializeUnableToConvertValue, propertyType);
 18654523                ex.AppendPathInformation = true;
 18654524            }
 525
 20088526            if (ex.AppendPathInformation)
 20088527            {
 20088528                message += $" Path: {path} | LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
 20088529                ex.SetMessage(message);
 20088530            }
 20088531        }
 532
 533        [DoesNotReturn]
 534        public static void ReThrowWithPath(ref WriteStack state, Exception ex)
 0535        {
 0536            JsonException jsonException = new JsonException(null, ex);
 0537            AddJsonExceptionInformation(ref state, jsonException);
 0538            throw jsonException;
 539        }
 540
 541        public static void AddJsonExceptionInformation(ref WriteStack state, JsonException ex)
 0542        {
 0543            Debug.Assert(ex.Path is null); // do not overwrite existing path information
 544
 0545            string path = state.PropertyPath();
 0546            ex.Path = path;
 547
 0548            string? message = ex._message;
 0549            if (string.IsNullOrEmpty(message))
 0550            {
 551                // Use a default message.
 0552                message = SR.SerializeUnableToSerialize;
 0553                ex.AppendPathInformation = true;
 0554            }
 555
 0556            if (ex.AppendPathInformation)
 0557            {
 0558                message += $" Path: {path}.";
 0559                ex.SetMessage(message);
 0560            }
 0561        }
 562
 563        [DoesNotReturn]
 564        public static void ThrowInvalidOperationException_SerializationDuplicateAttribute(Type attribute, MemberInfo mem
 0565        {
 0566            string location = memberInfo is Type type ? type.ToString() : $"{memberInfo.DeclaringType}.{memberInfo.Name}
 0567            throw new InvalidOperationException(SR.Format(SR.SerializationDuplicateAttribute, attribute, location));
 568        }
 569
 570        [DoesNotReturn]
 571        public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(Type classType, Type attri
 0572        {
 0573            throw new InvalidOperationException(SR.Format(SR.SerializationDuplicateTypeAttribute, classType, attribute))
 574        }
 575
 576        [DoesNotReturn]
 577        public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute<TAttribute>(Type classType
 0578        {
 0579            throw new InvalidOperationException(SR.Format(SR.SerializationDuplicateTypeAttribute, classType, typeof(TAtt
 580        }
 581
 582        [DoesNotReturn]
 583        public static void ThrowInvalidOperationException_ExtensionDataConflictsWithUnmappedMemberHandling(Type classTyp
 0584        {
 0585            throw new InvalidOperationException(SR.Format(SR.ExtensionDataConflictsWithUnmappedMemberHandling, classType
 586        }
 587
 588        [DoesNotReturn]
 589        public static void ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(JsonPropertyInfo jso
 0590        {
 0591            throw new InvalidOperationException(SR.Format(SR.SerializationDataExtensionPropertyInvalid, jsonPropertyInfo
 592        }
 593
 594        [DoesNotReturn]
 595        public static void ThrowInvalidOperationException_PropertyTypeNotNullable(JsonPropertyInfo jsonPropertyInfo)
 0596        {
 0597            throw new InvalidOperationException(SR.Format(SR.PropertyTypeNotNullable, jsonPropertyInfo.PropertyType));
 598        }
 599
 600        [DoesNotReturn]
 601        public static void ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty()
 0602        {
 0603            throw new InvalidOperationException(SR.NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty);
 604        }
 605
 606        [DoesNotReturn]
 607        public static void ThrowNotSupportedException(scoped ref ReadStack state, in Utf8JsonReader reader, Exception in
 0608        {
 0609            string message = innerException.Message;
 610
 611            // The caller should check to ensure path is not already set.
 0612            Debug.Assert(!message.Contains(" Path: "));
 613
 614            // Obtain the type to show in the message.
 0615            Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
 616
 0617            if (!message.Contains(propertyType.ToString()))
 0618            {
 0619                if (message.Length > 0)
 0620                {
 0621                    message += " ";
 0622                }
 623
 0624                message += SR.Format(SR.SerializationNotSupportedParentType, propertyType);
 0625            }
 626
 0627            long lineNumber = reader.CurrentState._lineNumber;
 0628            long bytePositionInLine = reader.CurrentState._bytePositionInLine;
 0629            message += $" Path: {state.JsonPath()} | LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}
 630
 0631            throw new NotSupportedException(message, innerException);
 632        }
 633
 634        [DoesNotReturn]
 635        public static void ThrowNotSupportedException(ref WriteStack state, Exception innerException)
 0636        {
 0637            string message = innerException.Message;
 638
 639            // The caller should check to ensure path is not already set.
 0640            Debug.Assert(!message.Contains(" Path: "));
 641
 642            // Obtain the type to show in the message.
 0643            Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
 644
 0645            if (!message.Contains(propertyType.ToString()))
 0646            {
 0647                if (message.Length > 0)
 0648                {
 0649                    message += " ";
 0650                }
 651
 0652                message += SR.Format(SR.SerializationNotSupportedParentType, propertyType);
 0653            }
 654
 0655            message += $" Path: {state.PropertyPath()}.";
 656
 0657            throw new NotSupportedException(message, innerException);
 658        }
 659
 660        [DoesNotReturn]
 661        public static void ThrowNotSupportedException_DeserializeNoConstructor(JsonTypeInfo typeInfo, ref Utf8JsonReader
 0662        {
 0663            Type type = typeInfo.Type;
 664            string message;
 665
 0666            if (type.IsInterface || type.IsAbstract)
 0667            {
 0668                if (typeInfo.PolymorphicTypeResolver?.UsesTypeDiscriminators is true)
 0669                {
 0670                    message = SR.Format(SR.DeserializationMustSpecifyTypeDiscriminator, type);
 0671                }
 0672                else if (typeInfo.Kind is JsonTypeInfoKind.Enumerable or JsonTypeInfoKind.Dictionary)
 0673                {
 0674                    message = SR.Format(SR.CannotPopulateCollection, type);
 0675                }
 676                else
 0677                {
 0678                    message = SR.Format(SR.DeserializeInterfaceOrAbstractType, type);
 0679                }
 0680            }
 681            else
 0682            {
 0683                message = SR.Format(SR.DeserializeNoConstructor, nameof(JsonConstructorAttribute), type);
 0684            }
 685
 0686            ThrowNotSupportedException(ref state, reader, new NotSupportedException(message));
 687        }
 688
 689        [DoesNotReturn]
 690        public static void ThrowNotSupportedException_CannotPopulateCollection(Type type, ref Utf8JsonReader reader, sco
 0691        {
 0692            ThrowNotSupportedException(ref state, reader, new NotSupportedException(SR.Format(SR.CannotPopulateCollectio
 693        }
 694
 695        [DoesNotReturn]
 696        public static void ThrowJsonException_MetadataValuesInvalidToken(JsonTokenType tokenType)
 0697        {
 0698            ThrowJsonException(SR.Format(SR.MetadataInvalidTokenAfterValues, tokenType));
 699        }
 700
 701        [DoesNotReturn]
 702        public static void ThrowJsonException_MetadataReferenceNotFound(string id)
 0703        {
 0704            ThrowJsonException(SR.Format(SR.MetadataReferenceNotFound, id));
 705        }
 706
 707        [DoesNotReturn]
 708        public static void ThrowJsonException_MetadataValueWasNotString(JsonTokenType tokenType)
 0709        {
 0710            ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, tokenType));
 711        }
 712
 713        [DoesNotReturn]
 714        public static void ThrowJsonException_MetadataValueWasNotString(JsonValueKind valueKind)
 0715        {
 0716            ThrowJsonException(SR.Format(SR.MetadataValueWasNotString, valueKind));
 717        }
 718
 719        [DoesNotReturn]
 720        public static void ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties(ReadOnlySpan<byte> pro
 0721        {
 0722            state.Current.JsonPropertyName = propertyName.ToArray();
 0723            ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties();
 724        }
 725
 726        [DoesNotReturn]
 727        public static void ThrowJsonException_MetadataUnexpectedProperty(ReadOnlySpan<byte> propertyName, scoped ref Rea
 0728        {
 0729            state.Current.JsonPropertyName = propertyName.ToArray();
 0730            ThrowJsonException(SR.MetadataUnexpectedProperty);
 731        }
 732
 733        [DoesNotReturn]
 734        public static void ThrowJsonException_UnmappedJsonProperty(Type type, string unmappedPropertyName)
 0735        {
 0736            throw new JsonException(SR.Format(SR.UnmappedJsonProperty, unmappedPropertyName, type));
 737        }
 738
 739        [DoesNotReturn]
 740        public static void ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties()
 0741        {
 0742            ThrowJsonException(SR.MetadataReferenceCannotContainOtherProperties);
 743        }
 744
 745        [DoesNotReturn]
 746        public static void ThrowJsonException_MetadataIdCannotBeCombinedWithRef(ReadOnlySpan<byte> propertyName, scoped 
 0747        {
 0748            state.Current.JsonPropertyName = propertyName.ToArray();
 0749            ThrowJsonException(SR.MetadataIdCannotBeCombinedWithRef);
 750        }
 751
 752        [DoesNotReturn]
 753        public static void ThrowJsonException_MetadataStandaloneValuesProperty(scoped ref ReadStack state, ReadOnlySpan<
 0754        {
 0755            state.Current.JsonPropertyName = propertyName.ToArray();
 0756            ThrowJsonException(SR.MetadataStandaloneValuesProperty);
 757        }
 758
 759        [DoesNotReturn]
 760        public static void ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(ReadOnlySpan<byte> propertyNa
 0761        {
 762            // Set PropertyInfo or KeyName to write down the conflicting property name in JsonException.Path
 0763            if (state.Current.IsProcessingDictionary())
 0764            {
 0765                state.Current.JsonPropertyNameAsString = reader.GetString();
 0766            }
 767            else
 0768            {
 0769                state.Current.JsonPropertyName = propertyName.ToArray();
 0770            }
 771
 0772            ThrowJsonException(SR.MetadataInvalidPropertyWithLeadingDollarSign);
 773        }
 774
 775        [DoesNotReturn]
 776        public static void ThrowJsonException_MetadataDuplicateIdFound(string id)
 0777        {
 0778            ThrowJsonException(SR.Format(SR.MetadataDuplicateIdFound, id));
 779        }
 780
 781        [DoesNotReturn]
 782        public static void ThrowJsonException_DuplicateMetadataProperty(ReadOnlySpan<byte> utf8PropertyName)
 0783        {
 0784            ThrowJsonException(SR.Format(SR.DuplicateMetadataProperty, Encoding.UTF8.GetString(utf8PropertyName)));
 785        }
 786
 787        [DoesNotReturn]
 788        public static void ThrowJsonException_MetadataInvalidReferenceToValueType(Type propertyType)
 0789        {
 0790            ThrowJsonException(SR.Format(SR.MetadataInvalidReferenceToValueType, propertyType));
 791        }
 792
 793        [DoesNotReturn]
 794        public static void ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(scoped ref ReadStack state, Type pr
 0795        {
 0796            state.Current.JsonPropertyName = reader.HasValueSequence ? reader.ValueSequence.ToArray() : reader.ValueSpan
 0797            string propertyNameAsString = reader.GetString()!;
 798
 0799            ThrowJsonException(SR.Format(SR.MetadataPreservedArrayFailed,
 0800                SR.Format(SR.MetadataInvalidPropertyInArrayMetadata, propertyNameAsString),
 0801                SR.Format(SR.DeserializeUnableToConvertValue, propertyType)));
 802        }
 803
 804        [DoesNotReturn]
 805        public static void ThrowJsonException_MetadataPreservedArrayValuesNotFound(scoped ref ReadStack state, Type prop
 0806        {
 807            // Missing $values, JSON path should point to the property's object.
 0808            state.Current.JsonPropertyName = null;
 809
 0810            ThrowJsonException(SR.Format(SR.MetadataPreservedArrayFailed,
 0811                SR.MetadataStandaloneValuesProperty,
 0812                SR.Format(SR.DeserializeUnableToConvertValue, propertyType)));
 813        }
 814
 815        [DoesNotReturn]
 816        public static void ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(Type propertyType)
 0817        {
 0818            ThrowJsonException(SR.Format(SR.MetadataCannotParsePreservedObjectToImmutable, propertyType));
 819        }
 820
 821        [DoesNotReturn]
 822        public static void ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(string reference
 0823        {
 0824            throw new InvalidOperationException(SR.Format(SR.MetadataReferenceOfTypeCannotBeAssignedToType, referenceId,
 825        }
 826
 827        [DoesNotReturn]
 828        public static void ThrowInvalidOperationException_JsonPropertyInfoIsBoundToDifferentJsonTypeInfo(JsonPropertyInf
 0829        {
 0830            Debug.Assert(propertyInfo.DeclaringTypeInfo != null, "We should not throw this exception when ParentTypeInfo
 0831            throw new InvalidOperationException(SR.Format(SR.JsonPropertyInfoBoundToDifferentParent, propertyInfo.Name, 
 832        }
 833
 834        [DoesNotReturn]
 835        internal static void ThrowUnexpectedMetadataException(
 836            ReadOnlySpan<byte> propertyName,
 837            ref Utf8JsonReader reader,
 838            scoped ref ReadStack state)
 0839        {
 840
 0841            MetadataPropertyName name = JsonSerializer.GetMetadataPropertyName(propertyName, state.Current.BaseJsonTypeI
 0842            if (name != 0)
 0843            {
 0844                ThrowJsonException_MetadataUnexpectedProperty(propertyName, ref state);
 845            }
 846            else
 0847            {
 0848                ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(propertyName, ref state, reader);
 849            }
 850        }
 851
 852        [DoesNotReturn]
 853        public static void ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
 0854        {
 0855            throw new NotSupportedException(SR.Format(SR.NoMetadataForType, type, resolver?.ToString() ?? "<null>"));
 856        }
 857
 858        public static NotSupportedException GetNotSupportedException_AmbiguousMetadataForType(Type type, Type match1, Ty
 0859        {
 0860            return new NotSupportedException(SR.Format(SR.AmbiguousMetadataForType, type, match1, match2));
 0861        }
 862
 863        [DoesNotReturn]
 864        public static void ThrowNotSupportedException_ConstructorContainsNullParameterNames(Type declaringType)
 0865        {
 0866            throw new NotSupportedException(SR.Format(SR.ConstructorContainsNullParameterNames, declaringType));
 867        }
 868
 869        [DoesNotReturn]
 870        public static void ThrowInvalidOperationException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
 0871        {
 0872            throw new InvalidOperationException(SR.Format(SR.NoMetadataForType, type, resolver?.ToString() ?? "<null>"))
 873        }
 874
 875        public static Exception GetInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver
 0876        {
 0877            return new InvalidOperationException(SR.Format(SR.NoMetadataForTypeProperties, resolver?.ToString() ?? "<nul
 0878        }
 879
 880        [DoesNotReturn]
 881        public static void ThrowInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, T
 0882        {
 0883            throw GetInvalidOperationException_NoMetadataForTypeProperties(resolver, type);
 884        }
 885
 886        [DoesNotReturn]
 887        public static void ThrowMissingMemberException_MissingFSharpCoreMember(string missingFsharpCoreMember)
 0888        {
 0889            throw new MissingMemberException(SR.Format(SR.MissingFSharpCoreMember, missingFsharpCoreMember));
 890        }
 891
 892        [DoesNotReturn]
 893        public static void ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(Type derivedType)
 0894        {
 0895            throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedTyp
 896        }
 897
 898        [DoesNotReturn]
 899        public static void ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(Type derivedType)
 0900        {
 0901            throw new NotSupportedException(SR.Format(SR.Polymorphism_DerivedConverterDoesNotSupportMetadata, derivedTyp
 902        }
 903
 904        [DoesNotReturn]
 905        public static void ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
 0906        {
 0907            throw new NotSupportedException(SR.Format(SR.Polymorphism_RuntimeTypeNotSupported, runtimeType, baseType));
 908        }
 909
 910        [DoesNotReturn]
 911        public static void ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(Type baseType, Type runtimeType, Type 
 0912        {
 0913            throw new NotSupportedException(SR.Format(SR.Polymorphism_RuntimeTypeDiamondAmbiguity, runtimeType, derivedT
 914        }
 915
 916        [DoesNotReturn]
 917        public static void ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(Type baseType)
 0918        {
 0919            throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDoesNotSupportPolymorphism, baseType));
 920        }
 921
 922        [DoesNotReturn]
 923        public static void ThrowInvalidOperationException_DerivedTypeNotSupported(Type baseType, Type derivedType)
 0924        {
 0925            throw new InvalidOperationException(SR.Format(SR.Polymorphism_DerivedTypeIsNotSupported, derivedType, baseTy
 926        }
 927
 928        [DoesNotReturn]
 929        public static void ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)
 0930        {
 0931            throw new InvalidOperationException(SR.Format(SR.Polymorphism_DerivedTypeIsAlreadySpecified, baseType, deriv
 932        }
 933
 934        [DoesNotReturn]
 935        public static void ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(Type baseType, object typ
 0936        {
 0937            throw new InvalidOperationException(SR.Format(SR.Polymorphism_TypeDicriminatorIdIsAlreadySpecified, baseType
 938        }
 939
 940        [DoesNotReturn]
 941        public static void ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName()
 0942        {
 0943            throw new InvalidOperationException(SR.Polymorphism_InvalidCustomTypeDiscriminatorPropertyName);
 944        }
 945
 946        [DoesNotReturn]
 947        public static void ThrowInvalidOperationException_PropertyConflictsWithMetadataPropertyName(Type type, string pr
 0948        {
 0949            throw new InvalidOperationException(SR.Format(SR.Polymorphism_PropertyConflictsWithMetadataPropertyName, typ
 950        }
 951
 952        [DoesNotReturn]
 953        public static void ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(Type ba
 0954        {
 0955            throw new InvalidOperationException(SR.Format(SR.Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes, baseT
 956        }
 957
 958        [DoesNotReturn]
 959        public static void ThrowInvalidOperationException_UnsupportedEnumIdentifier(Type enumType, string? enumName)
 0960        {
 0961            throw new InvalidOperationException(SR.Format(SR.UnsupportedEnumIdentifier, enumType.Name, enumName));
 962        }
 963
 964        [DoesNotReturn]
 965        public static void ThrowJsonException_UnrecognizedTypeDiscriminator(object typeDiscriminator)
 0966        {
 0967            ThrowJsonException(SR.Format(SR.Polymorphism_UnrecognizedTypeDiscriminator, typeDiscriminator));
 968        }
 969
 970        [DoesNotReturn]
 971        public static void ThrowArgumentException_JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo(string para
 0972        {
 0973            throw new ArgumentException(SR.JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo, paramName: parame
 974        }
 975
 976        [DoesNotReturn]
 977        public static void ThrowOperationCanceledException_PipeWriteCanceled()
 0978        {
 0979            throw new OperationCanceledException(SR.PipeWriterCanceled);
 980        }
 981
 982        [DoesNotReturn]
 983        public static void ThrowOperationCanceledException_PipeReadCanceled()
 0984        {
 0985            throw new OperationCanceledException(SR.PipeReaderCanceled);
 986        }
 987
 988        [DoesNotReturn]
 989        public static void ThrowInvalidOperationException_PipeWriterDoesNotImplementUnflushedBytes(PipeWriter pipeWriter
 0990        {
 0991            throw new InvalidOperationException(SR.Format(SR.PipeWriter_DoesNotImplementUnflushedBytes, pipeWriter.GetTy
 992        }
 993
 994        [DoesNotReturn]
 995        public static void ThrowNotSupportedException_JsonSchemaExporterDoesNotSupportReferenceHandlerPreserve()
 0996        {
 0997            throw new NotSupportedException(SR.JsonSchemaExporter_ReferenceHandlerPreserve_NotSupported);
 998        }
 999
 1000        [DoesNotReturn]
 1001        public static void ThrowInvalidOperationException_JsonSchemaExporterDepthTooLarge()
 01002        {
 01003            throw new InvalidOperationException(SR.JsonSchemaExporter_DepthTooLarge);
 1004        }
 1005    }
 1006}

Methods/Properties

ThrowArgumentNullException(System.String)
ThrowArgumentOutOfRangeException_NewLine(System.String)
ThrowArgumentOutOfRangeException_IndentCharacter(System.String)
ThrowArgumentOutOfRangeException_IndentSize(System.String,System.Int32,System.Int32)
ThrowArgumentOutOfRangeException_MaxDepthMustBePositive(System.String)
ThrowArgumentOutOfRangeException_JsonNumberExponentTooLarge(System.String)
GetArgumentOutOfRangeException(System.String,System.String)
ThrowArgumentOutOfRangeException_CommentEnumMustBeInRange(System.String)
ThrowArgumentOutOfRangeException_JsonConverterFactory_TypeNotSupported(System.Type)
ThrowArgumentOutOfRangeException_NeedNonNegNum(System.String)
ThrowArgumentException_InvalidOffLen()
GetArgumentException(System.String)
ThrowArgumentException(System.String)
ThrowArgumentException_DestinationTooShort()
ThrowArgumentException_PropertyNameTooLarge(System.Int32)
ThrowArgumentException_ValueTooLarge(System.Int64)
ThrowArgumentException_ValueNotSupported()
ThrowInvalidOperationException_NeedLargerSpan()
ThrowPropertyNameTooLargeArgumentException(System.Int32)
ThrowArgumentException(System.ReadOnlySpan`1<System.Byte>,System.ReadOnlySpan`1<System.Byte>)
ThrowArgumentException(System.ReadOnlySpan`1<System.Byte>,System.ReadOnlySpan`1<System.Char>)
ThrowArgumentException(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Byte>)
ThrowArgumentException(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>)
ThrowInvalidOperationOrArgumentException(System.ReadOnlySpan`1<System.Byte>,System.Int32,System.Int32)
ThrowInvalidOperationException(System.Int32,System.Int32)
ThrowInvalidOperationException(System.String)
GetInvalidOperationException(System.String)
ThrowInvalidOperationOrArgumentException(System.ReadOnlySpan`1<System.Char>,System.Int32,System.Int32)
GetInvalidOperationException_ExpectedArray(System.Text.Json.JsonTokenType)
GetInvalidOperationException_ExpectedObject(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedNumber(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedBoolean(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedString(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedPropertyName(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedStringComparison(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_ExpectedComment(System.Text.Json.JsonTokenType)
ThrowInvalidOperationException_CannotSkipOnPartial()
ThrowInvalidOperationException_CannotMixEncodings(System.Text.Json.Utf8JsonWriter/EnclosingContainerType,System.Text.Json.Utf8JsonWriter/EnclosingContainerType)
GetEncodingName(System.Text.Json.Utf8JsonWriter/EnclosingContainerType)
GetInvalidOperationException(System.String,System.Text.Json.JsonTokenType)
GetInvalidOperationException(System.Text.Json.JsonTokenType)
ThrowJsonElementWrongTypeException(System.Text.Json.JsonTokenType,System.Text.Json.JsonTokenType)
GetJsonElementWrongTypeException(System.Text.Json.JsonValueKind,System.Text.Json.JsonValueKind)
GetJsonElementWrongTypeException(System.String,System.Text.Json.JsonValueKind)
ThrowJsonReaderException(System.Text.Json.Utf8JsonReader&,System.Text.Json.ExceptionResource,System.Byte,System.ReadOnlySpan`1<System.Byte>)
GetJsonReaderException(System.Text.Json.Utf8JsonReader&,System.Text.Json.ExceptionResource,System.Byte,System.ReadOnlySpan`1<System.Byte>)
IsPrintable(System.Byte)
GetPrintableString(System.Byte)
GetResourceString(System.Text.Json.Utf8JsonReader&,System.Text.Json.ExceptionResource,System.Byte,System.String)
ThrowInvalidOperationException(System.Text.Json.ExceptionResource,System.Int32,System.Int32,System.Byte,System.Text.Json.JsonTokenType)
ThrowArgumentException_InvalidCommentValue()
ThrowArgumentException_InvalidUTF8(System.ReadOnlySpan`1<System.Byte>)
ThrowArgumentException_InvalidUTF16(System.Int32)
ThrowInvalidOperationException_ReadInvalidUTF16(System.Int32)
ThrowInvalidOperationException_ReadIncompleteUTF16()
GetInvalidOperationException_ReadInvalidUTF8(System.Text.DecoderFallbackException)
GetArgumentException_ReadInvalidUTF16(System.Text.EncoderFallbackException)
GetInvalidOperationException(System.String,System.Exception)
GetInvalidOperationException(System.Text.Json.ExceptionResource,System.Int32,System.Int32,System.Byte,System.Text.Json.JsonTokenType)
ThrowOutOfMemoryException(System.UInt32)
GetResourceString(System.Text.Json.ExceptionResource,System.Int32,System.Int32,System.Byte,System.Text.Json.JsonTokenType)
ThrowFormatException()
ThrowFormatException(System.Text.Json.NumericType)
ThrowFormatException(System.Text.Json.DataType)
ThrowInvalidOperationException_ExpectedChar(System.Text.Json.JsonTokenType)
ThrowObjectDisposedException_Utf8JsonWriter()
ThrowObjectDisposedException_JsonDocument()
ThrowInsufficientExecutionStackException_JsonElementDeepEqualsInsufficientExecutionStack()
ThrowArgumentException_NodeValueNotAllowed(System.String)
ThrowInvalidOperationException_NodeAlreadyHasParent()
ThrowInvalidOperationException_NodeCycleDetected()
ThrowInvalidOperationException_NodeElementCannotBeObjectOrArray()
ThrowInvalidOperationException_NodeWrongType(System.ReadOnlySpan`1<System.String>)
ThrowInvalidOperationException_NodeParentWrongType(System.String)
ThrowInvalidOperationException_NodeUnableToConvert(System.Type,System.Type)
ThrowInvalidOperationException_NodeUnableToConvertElement(System.Text.Json.JsonValueKind,System.Type)
ThrowArgumentException_DeserializeWrongType(System.Type,System.Object)
ThrowArgumentException_SerializerDoesNotSupportComments(System.String)
ThrowNotSupportedException_SerializationNotSupported(System.Type)
ThrowNotSupportedException_TypeRequiresAsyncSerialization(System.Type)
ThrowNotSupportedException_DictionaryKeyTypeNotSupported(System.Type,System.Text.Json.Serialization.JsonConverter)
ThrowJsonException_DeserializeUnableToConvertValue(System.Type)
ThrowInvalidCastException_DeserializeUnableToAssignValue(System.Type,System.Type)
ThrowInvalidOperationException_DeserializeUnableToAssignNull(System.Type)
ThrowJsonException_PropertyGetterDisallowNull(System.String,System.Type)
ThrowJsonException_PropertySetterDisallowNull(System.String,System.Type)
ThrowJsonException_ConstructorParameterDisallowNull(System.String,System.Type)
ThrowInvalidOperationException_ObjectCreationHandlingPopulateNotSupportedByConverter(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyMustHaveAGetter(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyValueTypeMustHaveASetter(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowPolymorphicDeserialization(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReadOnlyMember(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReferenceHandling()
ThrowNotSupportedException_ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors()
ThrowJsonException_SerializationConverterRead(System.Text.Json.Serialization.JsonConverter)
ThrowJsonException_SerializationConverterWrite(System.Text.Json.Serialization.JsonConverter)
ThrowJsonException_SerializerCycleDetected(System.Int32)
ThrowJsonException(System.String)
ThrowArgumentException_CannotSerializeInvalidType(System.String,System.Type,System.Type,System.String)
ThrowInvalidOperationException_CannotSerializeInvalidType(System.Type,System.Type,System.Reflection.MemberInfo)
ThrowInvalidOperationException_SerializationConverterNotCompatible(System.Type,System.Type)
ThrowInvalidOperationException_ResolverTypeNotCompatible(System.Type,System.Type)
ThrowInvalidOperationException_ResolverTypeInfoOptionsNotCompatible()
ThrowInvalidOperationException_JsonSerializerOptionsNoTypeInfoResolverSpecified()
ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled()
ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(System.Type,System.Reflection.MemberInfo)
ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(System.Type,System.Reflection.MemberInfo,System.Type)
ThrowInvalidOperationException_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_DuplicatePropertyNotAllowed(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowJsonException_DuplicatePropertyNotAllowed()
ThrowJsonException_DuplicatePropertyNotAllowed(System.String)
ThrowJsonException_DuplicatePropertyNotAllowed(System.ReadOnlySpan`1<System.Byte>)
Truncate(System.ReadOnlySpan`1<System.Char>)
ThrowInvalidOperationException_NamingPolicyReturnNull(System.Text.Json.JsonNamingPolicy)
ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(System.Type)
ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactory(System.Type)
ThrowInvalidOperationException_MultiplePropertiesBindToConstructorParameters(System.Type,System.String,System.String,System.String)
ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(System.Type)
ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(System.String,System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(System.String,System.Type)
ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(System.String,System.Type)
ThrowInvalidOperationException_NumberHandlingOnPropertyInvalid(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(System.Type,System.Text.Json.Serialization.JsonConverter)
ThrowNotSupportedException_ObjectWithParameterizedCtorRefMetadataNotSupported(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowInvalidOperationException_JsonTypeInfoOperationNotPossibleForKind(System.Text.Json.Serialization.Metadata.JsonTypeInfoKind)
ThrowInvalidOperationException_JsonTypeInfoOnDeserializingCallbacksNotSupported(System.Type)
ThrowInvalidOperationException_CreateObjectConverterNotCompatible(System.Type)
ReThrowWithPath(System.Text.Json.ReadStack&,System.Text.Json.JsonReaderException)
ReThrowWithPath(System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&,System.Exception)
AddJsonExceptionInformation(System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&,System.Text.Json.JsonException)
ReThrowWithPath(System.Text.Json.WriteStack&,System.Exception)
AddJsonExceptionInformation(System.Text.Json.WriteStack&,System.Text.Json.JsonException)
ThrowInvalidOperationException_SerializationDuplicateAttribute(System.Type,System.Reflection.MemberInfo)
ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(System.Type,System.Type)
ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(System.Type)
ThrowInvalidOperationException_ExtensionDataConflictsWithUnmappedMemberHandling(System.Type,System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_PropertyTypeNotNullable(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty()
ThrowNotSupportedException(System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&,System.Exception)
ThrowNotSupportedException(System.Text.Json.WriteStack&,System.Exception)
ThrowNotSupportedException_DeserializeNoConstructor(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowNotSupportedException_CannotPopulateCollection(System.Type,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowJsonException_MetadataValuesInvalidToken(System.Text.Json.JsonTokenType)
ThrowJsonException_MetadataReferenceNotFound(System.String)
ThrowJsonException_MetadataValueWasNotString(System.Text.Json.JsonTokenType)
ThrowJsonException_MetadataValueWasNotString(System.Text.Json.JsonValueKind)
ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&)
ThrowJsonException_MetadataUnexpectedProperty(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&)
ThrowJsonException_UnmappedJsonProperty(System.Type,System.String)
ThrowJsonException_MetadataReferenceObjectCannotContainOtherProperties()
ThrowJsonException_MetadataIdCannotBeCombinedWithRef(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&)
ThrowJsonException_MetadataStandaloneValuesProperty(System.Text.Json.ReadStack&,System.ReadOnlySpan`1<System.Byte>)
ThrowJsonException_MetadataInvalidPropertyWithLeadingDollarSign(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.ReadStack&,System.Text.Json.Utf8JsonReader&)
ThrowJsonException_MetadataDuplicateIdFound(System.String)
ThrowJsonException_DuplicateMetadataProperty(System.ReadOnlySpan`1<System.Byte>)
ThrowJsonException_MetadataInvalidReferenceToValueType(System.Type)
ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(System.Text.Json.ReadStack&,System.Type,System.Text.Json.Utf8JsonReader&)
ThrowJsonException_MetadataPreservedArrayValuesNotFound(System.Text.Json.ReadStack&,System.Type)
ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(System.Type)
ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(System.String,System.Type,System.Type)
ThrowInvalidOperationException_JsonPropertyInfoIsBoundToDifferentJsonTypeInfo(System.Text.Json.Serialization.Metadata.JsonPropertyInfo)
ThrowUnexpectedMetadataException(System.ReadOnlySpan`1<System.Byte>,System.Text.Json.Utf8JsonReader&,System.Text.Json.ReadStack&)
ThrowNotSupportedException_NoMetadataForType(System.Type,System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver)
GetNotSupportedException_AmbiguousMetadataForType(System.Type,System.Type,System.Type)
ThrowNotSupportedException_ConstructorContainsNullParameterNames(System.Type)
ThrowInvalidOperationException_NoMetadataForType(System.Type,System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver)
GetInvalidOperationException_NoMetadataForTypeProperties(System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver,System.Type)
ThrowInvalidOperationException_NoMetadataForTypeProperties(System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver,System.Type)
ThrowMissingMemberException_MissingFSharpCoreMember(System.String)
ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(System.Type)
ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(System.Type)
ThrowNotSupportedException_RuntimeTypeNotSupported(System.Type,System.Type)
ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(System.Type,System.Type,System.Type,System.Type)
ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(System.Type)
ThrowInvalidOperationException_DerivedTypeNotSupported(System.Type,System.Type)
ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(System.Type,System.Type)
ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(System.Type,System.Object)
ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName()
ThrowInvalidOperationException_PropertyConflictsWithMetadataPropertyName(System.Type,System.String)
ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(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()