11 writes to Current
System.Text.Json (11)
System\Text\Json\Serialization\Converters\Object\ObjectDefaultConverter.cs (2)
263jsonTypeInfo.UpdateUtf8PropertyCache(ref state.Current); 312jsonTypeInfo.UpdateUtf8PropertyCache(ref state.Current);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (3)
66obj = (T)CreateObject(ref state.Current); 205obj = (T)CreateObject(ref state.Current); 267jsonTypeInfo.UpdateUtf8PropertyCache(ref state.Current);
System\Text\Json\Serialization\JsonSerializer.Read.HandlePropertyName.cs (1)
32ref state.Current,
System\Text\Json\Serialization\ReadStack.cs (5)
130Current = default; 147Current = _stack[_count - 1]; 194Current = _stack[_count - 1]; 202Current = _stack[_count - 1]; 275AppendStackFrame(sb, ref Current);
459 references to Current
System.Text.Json (459)
System\Text\Json\Serialization\Converters\Collection\ArrayConverter.cs (4)
18((List<TElement>)state.Current.ReturnValue!).Add(value); 24state.Current.ReturnValue = new List<TElement>(); 30List<TElement> list = (List<TElement>)state.Current.ReturnValue!; 31state.Current.ReturnValue = list.ToArray();
System\Text\Json\Serialization\Converters\Collection\ConcurrentQueueOfTConverter.cs (1)
16((TCollection)state.Current.ReturnValue!).Enqueue(value);
System\Text\Json\Serialization\Converters\Collection\ConcurrentStackOfTConverter.cs (1)
16((TCollection)state.Current.ReturnValue!).Push(value);
System\Text\Json\Serialization\Converters\Collection\DictionaryOfTKeyTValueConverter.cs (1)
22((TCollection)state.Current.ReturnValue!)[key] = value;
System\Text\Json\Serialization\Converters\Collection\IAsyncEnumerableOfTConverter.cs (2)
27((BufferedAsyncEnumerable)state.Current.ReturnValue!)._buffer.Add(value); 33state.Current.ReturnValue = new BufferedAsyncEnumerable();
System\Text\Json\Serialization\Converters\Collection\ICollectionOfTConverter.cs (4)
21TCollection collection = (TCollection)state.Current.ReturnValue!; 25state.Current.ReturnValue = collection; 32TCollection returnValue = (TCollection)state.Current.ReturnValue!; 35state.Current.ReturnValue = null; // clear out for more accurate JsonPath reporting.
System\Text\Json\Serialization\Converters\Collection\IDictionaryConverter.cs (4)
23TDictionary collection = (TDictionary)state.Current.ReturnValue!; 27state.Current.ReturnValue = collection; 34TDictionary returnValue = (TDictionary)state.Current.ReturnValue!; 37state.Current.ReturnValue = null; // clear out for more accurate JsonPath reporting.
System\Text\Json\Serialization\Converters\Collection\IDictionaryOfTKeyTValueConverter.cs (4)
23TDictionary collection = (TDictionary)state.Current.ReturnValue!; 27state.Current.ReturnValue = collection; 34TDictionary returnValue = (TDictionary)state.Current.ReturnValue!; 37state.Current.ReturnValue = null; // clear out for more accurate JsonPath reporting.
System\Text\Json\Serialization\Converters\Collection\IEnumerableConverter.cs (2)
22((List<object?>)state.Current.ReturnValue!).Add(value); 33state.Current.ReturnValue = new List<object?>();
System\Text\Json\Serialization\Converters\Collection\IEnumerableOfTConverter.cs (2)
20((List<TElement>)state.Current.ReturnValue!).Add(value); 31state.Current.ReturnValue = new List<TElement>();
System\Text\Json\Serialization\Converters\Collection\IListConverter.cs (4)
20TCollection collection = (TCollection)state.Current.ReturnValue!; 24state.Current.ReturnValue = collection; 31TCollection returnValue = (TCollection)state.Current.ReturnValue!; 34state.Current.ReturnValue = null; // clear out for more accurate JsonPath reporting.
System\Text\Json\Serialization\Converters\Collection\IListOfTConverter.cs (4)
21TCollection collection = (TCollection)state.Current.ReturnValue!; 25state.Current.ReturnValue = collection; 32TCollection returnValue = (TCollection)state.Current.ReturnValue!; 35state.Current.ReturnValue = null; // clear out for more accurate JsonPath reporting.
System\Text\Json\Serialization\Converters\Collection\ImmutableDictionaryOfTKeyTValueConverter.cs (5)
17((Dictionary<TKey, TValue>)state.Current.ReturnValue!)[key] = value; 25state.Current.ReturnValue = new Dictionary<TKey, TValue>(); 32(Func<IEnumerable<KeyValuePair<TKey, TValue>>, TDictionary>?)state.Current.JsonTypeInfo.CreateObjectWithArgs; 34state.Current.ReturnValue = creator((Dictionary<TKey, TValue>)state.Current.ReturnValue!);
System\Text\Json\Serialization\Converters\Collection\ImmutableEnumerableOfTConverter.cs (5)
16((List<TElement>)state.Current.ReturnValue!).Add(value); 24state.Current.ReturnValue = new List<TElement>(); 30JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 34state.Current.ReturnValue = creator((List<TElement>)state.Current.ReturnValue!);
System\Text\Json\Serialization\Converters\Collection\IReadOnlyDictionaryOfTKeyTValueConverter.cs (2)
18((Dictionary<TKey, TValue>)state.Current.ReturnValue!)[key] = value; 29state.Current.ReturnValue = new Dictionary<TKey, TValue>();
System\Text\Json\Serialization\Converters\Collection\ISetOfTConverter.cs (4)
18TCollection collection = (TCollection)state.Current.ReturnValue!; 22state.Current.ReturnValue = collection; 29TCollection returnValue = (TCollection)state.Current.ReturnValue!; 32state.Current.ReturnValue = null; // clear out for more accurate JsonPath reporting.
System\Text\Json\Serialization\Converters\Collection\JsonCollectionConverter.cs (41)
33JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 40state.Current.ReturnValue = typeInfo.CreateObject(); 41Debug.Assert(state.Current.ReturnValue is TCollection); 68JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 71if (!state.SupportContinuation && !state.Current.CanContainMetadata) 82jsonTypeInfo.OnDeserializing?.Invoke(state.Current.ReturnValue!); 84state.Current.JsonPropertyInfo = elementTypeInfo.PropertyInfoForTypeInfo; 86if (elementConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 122if (state.Current.ObjectState == StackFrameObjectState.None) 126state.Current.ObjectState = StackFrameObjectState.ReadMetadata; 128else if (state.Current.CanContainMetadata) 135state.Current.ObjectState = StackFrameObjectState.StartToken; 144if (state.Current.CanContainMetadata && state.Current.ObjectState < StackFrameObjectState.ReadMetadata) 152if (state.Current.MetadataPropertyNames == MetadataPropertyName.Ref) 158state.Current.ObjectState = StackFrameObjectState.ReadMetadata; 162if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Type) != 0 && 163state.Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted && 173if (state.Current.ObjectState < StackFrameObjectState.CreatedObject) 175if (state.Current.CanContainMetadata) 182if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0) 186Debug.Assert(state.Current.ReturnValue is TCollection); 187state.ReferenceResolver.AddReference(state.ReferenceId, state.Current.ReturnValue); 191jsonTypeInfo.OnDeserializing?.Invoke(state.Current.ReturnValue!); 193state.Current.ObjectState = StackFrameObjectState.CreatedObject; 196if (state.Current.ObjectState < StackFrameObjectState.ReadElements) 199state.Current.JsonPropertyInfo = elementTypeInfo.PropertyInfoForTypeInfo; 204if (state.Current.PropertyState < StackFramePropertyState.ReadValue) 212state.Current.PropertyState = StackFramePropertyState.ReadValue; 215if (state.Current.PropertyState < StackFramePropertyState.ReadValueIsEnd) 222state.Current.PropertyState = StackFramePropertyState.ReadValueIsEnd; 225if (state.Current.PropertyState < StackFramePropertyState.TryRead) 237state.Current.EndElement(); 241state.Current.ObjectState = StackFrameObjectState.ReadElements; 244if (state.Current.ObjectState < StackFrameObjectState.EndToken) 247if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Values) != 0) 256state.Current.ObjectState = StackFrameObjectState.EndToken; 259if (state.Current.ObjectState < StackFrameObjectState.EndTokenValidation) 262if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Values) != 0) 269Debug.Assert(JsonSerializer.IsMetadataPropertyName(reader.GetUnescapedSpan(), (state.Current.BaseJsonTypeInfo ?? jsonTypeInfo).PolymorphicTypeResolver), "should only be hit if metadata property."); 284object returnValue = state.Current.ReturnValue!;
System\Text\Json\Serialization\Converters\Collection\JsonDictionaryConverter.cs (44)
48JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 55state.Current.ReturnValue = typeInfo.CreateObject(); 56Debug.Assert(state.Current.ReturnValue is TDictionary); 79JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 83if (!state.SupportContinuation && !state.Current.CanContainMetadata) 94jsonTypeInfo.OnDeserializing?.Invoke(state.Current.ReturnValue!); 99if (_valueConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 115state.Current.JsonPropertyInfo = keyTypeInfo.PropertyInfoForTypeInfo; 120state.Current.JsonPropertyInfo = elementTypeInfo.PropertyInfoForTypeInfo; 140state.Current.JsonPropertyInfo = keyTypeInfo.PropertyInfoForTypeInfo; 146state.Current.JsonPropertyInfo = elementTypeInfo.PropertyInfoForTypeInfo; 155if (state.Current.ObjectState == StackFrameObjectState.None) 162state.Current.ObjectState = StackFrameObjectState.StartToken; 166if (state.Current.CanContainMetadata && state.Current.ObjectState < StackFrameObjectState.ReadMetadata) 174if (state.Current.MetadataPropertyNames == MetadataPropertyName.Ref) 180state.Current.ObjectState = StackFrameObjectState.ReadMetadata; 184if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Type) != 0 && 185state.Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted && 196if (state.Current.ObjectState < StackFrameObjectState.CreatedObject) 198if (state.Current.CanContainMetadata) 205if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0) 209Debug.Assert(state.Current.ReturnValue is TDictionary); 210state.ReferenceResolver.AddReference(state.ReferenceId, state.Current.ReturnValue); 214jsonTypeInfo.OnDeserializing?.Invoke(state.Current.ReturnValue!); 216state.Current.ObjectState = StackFrameObjectState.CreatedObject; 224if (state.Current.PropertyState == StackFramePropertyState.None) 233state.Current.PropertyState = StackFramePropertyState.ReadName; 238if (state.Current.PropertyState < StackFramePropertyState.Name) 248state.Current.PropertyState = StackFramePropertyState.Name; 250if (state.Current.CanContainMetadata) 253if (JsonSerializer.IsMetadataPropertyName(propertyName, state.Current.BaseJsonTypeInfo.PolymorphicTypeResolver)) 258state.Current.EndElement(); 268state.Current.JsonPropertyInfo = keyTypeInfo.PropertyInfoForTypeInfo; 274key = (TKey)state.Current.DictionaryKey!; 277if (state.Current.PropertyState < StackFramePropertyState.ReadValue) 281state.Current.DictionaryKey = key; 286state.Current.PropertyState = StackFramePropertyState.ReadValue; 289if (state.Current.PropertyState < StackFramePropertyState.TryRead) 292state.Current.JsonPropertyInfo = elementTypeInfo.PropertyInfoForTypeInfo; 296state.Current.DictionaryKey = key; 302state.Current.EndElement(); 308object result = state.Current.ReturnValue!; 318state.Current.JsonPropertyNameAsString = unescapedPropertyNameAsString; // Copy key name for JSON Path support in case of error.
System\Text\Json\Serialization\Converters\Collection\ListOfTConverter.cs (5)
18((TCollection)state.Current.ReturnValue!).Add(value); 28if (state.Current.JsonTypeInfo.CreateObject == null) 30ThrowHelper.ThrowNotSupportedException_SerializationNotSupported(state.Current.JsonTypeInfo.Type); 33state.Current.ReturnValue = state.Current.JsonTypeInfo.CreateObject();
System\Text\Json\Serialization\Converters\Collection\MemoryConverter.cs (4)
32((List<T>)state.Current.ReturnValue!).Add(value); 37state.Current.ReturnValue = new List<T>(); 43Memory<T> memory = ((List<T>)state.Current.ReturnValue!).ToArray().AsMemory(); 44state.Current.ReturnValue = memory;
System\Text\Json\Serialization\Converters\Collection\QueueOfTConverter.cs (5)
16((TCollection)state.Current.ReturnValue!).Enqueue(value); 26if (state.Current.JsonTypeInfo.CreateObject == null) 28ThrowHelper.ThrowNotSupportedException_SerializationNotSupported(state.Current.JsonTypeInfo.Type); 31state.Current.ReturnValue = state.Current.JsonTypeInfo.CreateObject();
System\Text\Json\Serialization\Converters\Collection\ReadOnlyMemoryConverter.cs (4)
32((List<T>)state.Current.ReturnValue!).Add(value); 37state.Current.ReturnValue = new List<T>(); 43ReadOnlyMemory<T> memory = ((List<T>)state.Current.ReturnValue!).ToArray().AsMemory(); 44state.Current.ReturnValue = memory;
System\Text\Json\Serialization\Converters\Collection\RootLevelListConverter.cs (6)
31state.Current.JsonPropertyInfo = _elementTypeInfo.PropertyInfoForTypeInfo; 32var results = (List<T?>?)state.Current.ReturnValue; 36if (state.Current.PropertyState < StackFramePropertyState.ReadValue) 53state.Current.PropertyState = StackFramePropertyState.ReadValue; 65state.Current.ReturnValue = results = []; 69state.Current.EndElement();
System\Text\Json\Serialization\Converters\Collection\StackOfTConverter.cs (5)
17((TCollection)state.Current.ReturnValue!).Push(value); 27if (state.Current.JsonTypeInfo.CreateObject == null) 29ThrowHelper.ThrowNotSupportedException_SerializationNotSupported(state.Current.JsonTypeInfo.Type); 32state.Current.ReturnValue = state.Current.JsonTypeInfo.CreateObject();
System\Text\Json\Serialization\Converters\Collection\StackOrQueueConverter.cs (4)
18var addMethodDelegate = ((Action<TCollection, object?>?)state.Current.JsonTypeInfo.AddMethodDelegate); 20addMethodDelegate((TCollection)state.Current.ReturnValue!, value); 30JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 38state.Current.ReturnValue = constructorDelegate();
System\Text\Json\Serialization\Converters\FSharp\FSharpListConverter.cs (4)
25((List<TElement>)state.Current.ReturnValue!).Add(value); 31state.Current.ReturnValue = new List<TElement>(); 37state.Current.ReturnValue = _listConstructor((List<TElement>)state.Current.ReturnValue!);
System\Text\Json\Serialization\Converters\FSharp\FSharpMapConverter.cs (4)
26((List<Tuple<TKey, TValue>>)state.Current.ReturnValue!).Add(new Tuple<TKey, TValue>(key, value)); 34state.Current.ReturnValue = new List<Tuple<TKey, TValue>>(); 40state.Current.ReturnValue = _mapConstructor((List<Tuple<TKey, TValue>>)state.Current.ReturnValue!);
System\Text\Json\Serialization\Converters\FSharp\FSharpOptionConverter.cs (2)
42state.Current.JsonPropertyInfo = state.Current.JsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo;
System\Text\Json\Serialization\Converters\FSharp\FSharpSetConverter.cs (4)
25((List<TElement>)state.Current.ReturnValue!).Add(value); 31state.Current.ReturnValue = new List<TElement>(); 37state.Current.ReturnValue = _setConstructor((List<TElement>)state.Current.ReturnValue!);
System\Text\Json\Serialization\Converters\FSharp\FSharpValueOptionConverter.cs (2)
42state.Current.JsonPropertyInfo = state.Current.JsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo;
System\Text\Json\Serialization\Converters\Object\ObjectDefaultConverter.cs (47)
22JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 26if (!state.SupportContinuation && !state.Current.CanContainMetadata) 37obj = state.Current.ReturnValue!; 58if (state.Current.ObjectState == StackFrameObjectState.None) 65state.Current.ObjectState = StackFrameObjectState.StartToken; 69if (state.Current.CanContainMetadata && state.Current.ObjectState < StackFrameObjectState.ReadMetadata) 77if (state.Current.MetadataPropertyNames == MetadataPropertyName.Ref) 83state.Current.ObjectState = StackFrameObjectState.ReadMetadata; 87if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Type) != 0 && 88state.Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted && 98if (state.Current.ObjectState < StackFrameObjectState.CreatedObject) 100if (state.Current.CanContainMetadata) 105if (state.Current.MetadataPropertyNames == MetadataPropertyName.Ref) 113obj = state.Current.ReturnValue!; 125if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0) 135state.Current.ReturnValue = obj; 136state.Current.ObjectState = StackFrameObjectState.CreatedObject; 137state.Current.InitializeRequiredPropertiesValidationState(jsonTypeInfo); 141obj = state.Current.ReturnValue!; 149if (state.Current.PropertyState == StackFramePropertyState.None) 153state.Current.ReturnValue = obj; 158state.Current.PropertyState = StackFramePropertyState.ReadName; 163if (state.Current.PropertyState < StackFramePropertyState.Name) 180state.Current.EndProperty(); 191state.Current.UseExtensionProperty = useExtensionProperty; 192state.Current.PropertyState = StackFramePropertyState.Name; 196Debug.Assert(state.Current.JsonPropertyInfo != null); 197jsonPropertyInfo = state.Current.JsonPropertyInfo!; 200if (state.Current.PropertyState < StackFramePropertyState.ReadValue) 204if (!reader.TrySkipPartial(targetDepth: state.Current.OriginalDepth + 1)) 206state.Current.ReturnValue = obj; 211state.Current.EndProperty(); 217state.Current.ReturnValue = obj; 222state.Current.PropertyState = StackFramePropertyState.ReadValue; 225if (state.Current.PropertyState < StackFramePropertyState.TryRead) 228if (!state.Current.UseExtensionProperty) 232state.Current.ReturnValue = obj; 242state.Current.ReturnValue = obj; 248state.Current.EndProperty(); 254state.Current.ValidateAllRequiredPropertiesAreRead(jsonTypeInfo); 261if (state.Current.PropertyRefCacheBuilder != null) 274state.Current.InitializeRequiredPropertiesValidationState(jsonTypeInfo); 307state.Current.ValidateAllRequiredPropertiesAreRead(jsonTypeInfo); 310if (state.Current.PropertyRefCacheBuilder != null) 493state.Current.EndProperty(); 499bool requiresReadAhead = jsonPropertyInfo.EffectiveConverter.RequiresReadAhead || state.Current.UseExtensionProperty;
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (70)
26JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 28if (!jsonTypeInfo.UsesParameterizedConstructor || state.Current.IsPopulating) 37ArgumentState argumentState = state.Current.CtorArgumentState!; 39if (!state.SupportContinuation && !state.Current.CanContainMetadata) 50object populatedObject = state.Current.ReturnValue!; 64state.Current.ValidateAllRequiredPropertiesAreRead(jsonTypeInfo); 96state.Current.JsonPropertyName = propertyNameArray; 97state.Current.JsonPropertyInfo = jsonPropertyInfo; 98state.Current.NumberHandling = jsonPropertyInfo.EffectiveNumberHandling; 104Debug.Assert(jsonPropertyInfo == state.Current.JsonTypeInfo.ExtensionDataProperty); 105state.Current.JsonPropertyNameAsString = dataExtKey; 121if (state.Current.ObjectState == StackFrameObjectState.None) 128state.Current.ObjectState = StackFrameObjectState.StartToken; 132if (state.Current.CanContainMetadata && state.Current.ObjectState < StackFrameObjectState.ReadMetadata) 140if (state.Current.MetadataPropertyNames == MetadataPropertyName.Ref) 146state.Current.ObjectState = StackFrameObjectState.ReadMetadata; 150if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Type) != 0 && 151state.Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted && 167object populatedObject = state.Current.ReturnValue!; 170state.Current.ObjectState = StackFrameObjectState.CreatedObject; 171state.Current.InitializeRequiredPropertiesValidationState(jsonTypeInfo); 176if (state.Current.ObjectState < StackFrameObjectState.ConstructorArguments) 178if (state.Current.CanContainMetadata) 183if (state.Current.MetadataPropertyNames == MetadataPropertyName.Ref) 191state.Current.ObjectState = StackFrameObjectState.ConstructorArguments; 203state.Current.ValidateAllRequiredPropertiesAreRead(jsonTypeInfo); 207if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0) 236Debug.Assert(jsonPropertyInfo == state.Current.JsonTypeInfo.ExtensionDataProperty); 265if (state.Current.PropertyRefCacheBuilder != null) 307state.Current.EndProperty(); 332state.Current.EndConstructorParameter(); 339state.Current.EndConstructorParameter(); 345ArgumentState argumentState = state.Current.CtorArgumentState!; 350ArrayPool<FoundProperty>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length)); 371state.Current.JsonPropertyName, 372state.Current.JsonPropertyNameAsString); 376state.Current.EndProperty(); 387if (state.Current.PropertyState == StackFramePropertyState.None) 394state.Current.PropertyState = StackFramePropertyState.ReadName; 400if (state.Current.PropertyState < StackFramePropertyState.Name) 417state.Current.EndProperty(); 431state.Current.PropertyState = StackFramePropertyState.Name; 435jsonParameterInfo = state.Current.CtorArgumentState!.JsonParameterInfo; 436jsonPropertyInfo = state.Current.JsonPropertyInfo; 464if (state.Current.PropertyState < StackFramePropertyState.ReadValue) 468if (!reader.TrySkipPartial(targetDepth: state.Current.OriginalDepth + 1)) 473state.Current.EndConstructorParameter(); 482state.Current.PropertyState = StackFramePropertyState.ReadValue; 490state.Current.EndConstructorParameter(); 500if (state.Current.PropertyState < StackFramePropertyState.ReadValue) 504if (!reader.TrySkipPartial(targetDepth: state.Current.OriginalDepth + 1)) 509state.Current.EndProperty(); 518state.Current.PropertyState = StackFramePropertyState.ReadValue; 523if (state.Current.UseExtensionProperty) 542ArgumentState argumentState = state.Current.CtorArgumentState!; 546argumentState.FoundPropertiesAsync = ArrayPool<FoundPropertyAsync>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length)); 566state.Current.JsonPropertyNameAsString); 568state.Current.EndProperty(); 575JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 584state.Current.InitializeRequiredPropertiesValidationState(jsonTypeInfo); 587state.Current.JsonPropertyInfo = null; 589Debug.Assert(state.Current.CtorArgumentState != null); 604Debug.Assert(state.Current.JsonTypeInfo.Kind is JsonTypeInfoKind.Object); 605Debug.Assert(state.Current.CtorArgumentState != null); 616state.Current.MarkRequiredPropertyAsRead(jsonPropertyInfo); 621state.Current.JsonPropertyInfo = null; 622state.Current.CtorArgumentState!.JsonParameterInfo = jsonParameterInfo; 623state.Current.NumberHandling = jsonParameterInfo.NumberHandling; 628state.Current.UseExtensionProperty = useExtensionProperty;
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.Large.cs (4)
27ThrowHelper.ThrowJsonException_ConstructorParameterDisallowNull(jsonParameterInfo.Name, state.Current.JsonTypeInfo.Type); 30((object[])state.Current.CtorArgumentState!.Arguments)[jsonParameterInfo.Position] = arg!; 54JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 62state.Current.CtorArgumentState!.Arguments = arguments;
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.Small.cs (5)
30Debug.Assert(state.Current.CtorArgumentState!.Arguments != null); 31var arguments = (Arguments<TArg0, TArg1, TArg2, TArg3>)state.Current.CtorArgumentState.Arguments; 80ThrowHelper.ThrowJsonException_ConstructorParameterDisallowNull(info.Name, state.Current.JsonTypeInfo.Type); 91JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 119state.Current.CtorArgumentState!.Arguments = arguments;
System\Text\Json\Serialization\Converters\Value\NullableConverter.cs (5)
36JsonTypeInfo previousTypeInfo = state.Current.JsonTypeInfo; 37state.Current.JsonTypeInfo = state.Current.JsonTypeInfo.ElementTypeInfo!; 41state.Current.JsonTypeInfo = previousTypeInfo; 45state.Current.JsonTypeInfo = previousTypeInfo;
System\Text\Json\Serialization\JsonConverter.MetadataHandling.cs (5)
18Debug.Assert((state.Current.MetadataPropertyNames & MetadataPropertyName.Type) != 0); 19Debug.Assert(state.Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted); 24switch (state.Current.PolymorphicSerializationState) 43state.Current.PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryNotFound; 55Debug.Assert(state.Current.PolymorphicJsonTypeInfo is null);
System\Text\Json\Serialization\JsonConverterOfT.cs (15)
187if (state.Current.NumberHandling != null && IsInternalConverterForNumberType) 189value = ReadNumberWithCustomHandling(ref reader, state.Current.NumberHandling.Value, options); 227JsonPropertyInfo? propertyInfo = state.Current.JsonPropertyInfo; 228object? parentObj = state.Current.ReturnValue; 232JsonTypeInfo originalJsonTypeInfo = state.Current.JsonTypeInfo; 235Debug.Assert(Type == state.Current.JsonTypeInfo.Type); 241Debug.Assert(state.Current.OriginalTokenType == JsonTokenType.None); 242state.Current.OriginalTokenType = reader.TokenType; 244Debug.Assert(state.Current.OriginalDepth == 0); 245state.Current.OriginalDepth = reader.CurrentDepth; 250state.Current.HasParentObject = true; 264state.Current.OriginalTokenType, 265state.Current.OriginalDepth, 274isPopulatedValue = state.Current.IsPopulating; 277Debug.Assert(ReferenceEquals(originalJsonTypeInfo, state.Current.JsonTypeInfo));
System\Text\Json\Serialization\JsonConverterOfT.ReadCore.cs (3)
24if (state.SupportContinuation && state.Current.ReturnValue is object result) 40bool success = TryRead(ref reader, state.Current.JsonTypeInfo.Type, options, ref state, out value, out _); 50state.Current.ReturnValue = value;
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (34)
27Debug.Assert(state.Current.ObjectState == StackFrameObjectState.StartToken); 28Debug.Assert(state.Current.CanContainMetadata); 53if (state.Current.PropertyState == StackFramePropertyState.None) 62state.Current.PropertyState = StackFramePropertyState.ReadName; 65if (state.Current.PropertyState < StackFramePropertyState.Name) 76if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Ref) != 0) 83switch (state.Current.LatestMetadataPropertyName = GetMetadataPropertyName(propertyName, jsonTypeInfo.PolymorphicTypeResolver)) 86state.Current.JsonPropertyName = s_idPropertyName; 93if ((state.Current.MetadataPropertyNames & (MetadataPropertyName.Id | MetadataPropertyName.Ref)) != 0) 107state.Current.JsonPropertyName = s_refPropertyName; 119if (state.Current.MetadataPropertyNames != 0 || isReadingAheadOfNonMetadataProperties) 128state.Current.JsonPropertyName = jsonTypeInfo.PolymorphicTypeResolver?.CustomTypeDiscriminatorPropertyNameUtf8 ?? s_typePropertyName; 138ThrowHelper.ThrowJsonException_DuplicateMetadataProperty(state.Current.JsonPropertyName); 144state.Current.JsonPropertyName = s_valuesPropertyName; 146if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Values) != 0) 161Debug.Assert(state.Current.LatestMetadataPropertyName == MetadataPropertyName.None); 173if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Values) != 0) 194state.Current.PropertyState = StackFramePropertyState.Name; 197if (state.Current.PropertyState < StackFramePropertyState.ReadValue) 206state.Current.PropertyState = StackFramePropertyState.ReadValue; 209Debug.Assert(state.Current.PropertyState == StackFramePropertyState.ReadValue); 211switch (state.Current.LatestMetadataPropertyName) 277state.Current.MetadataPropertyNames |= MetadataPropertyName.Values; 278state.Current.PropertyState = StackFramePropertyState.None; 285Debug.Assert(state.Current.LatestMetadataPropertyName == MetadataPropertyName.None); 292state.Current.MetadataPropertyNames |= state.Current.LatestMetadataPropertyName; 293state.Current.PropertyState = StackFramePropertyState.None; 294state.Current.JsonPropertyName = null; 298if (state.Current.MetadataPropertyNames is MetadataPropertyName.Values) 485if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Values) != 0) 497Debug.Assert(state.Current.MetadataPropertyNames is MetadataPropertyName.None || state.Current.MetadataPropertyNames.HasFlag(MetadataPropertyName.Values)); 501if (state.Current.MetadataPropertyNames != MetadataPropertyName.Ref)
System\Text\Json\Serialization\JsonSerializer.Read.HandlePropertyName.cs (8)
27JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 36state.Current.PropertyIndex++; 39state.Current.JsonPropertyName = utf8PropertyName; 54state.Current.JsonPropertyNameAsString = JsonHelpers.Utf8GetString(unescapedPropertyName); 72state.Current.JsonPropertyInfo = jsonPropertyInfo; 73state.Current.NumberHandling = jsonPropertyInfo.EffectiveNumberHandling; 87if (state.Current.CanContainMetadata) 89if (IsMetadataPropertyName(propertyName, state.Current.BaseJsonTypeInfo.PolymorphicTypeResolver))
System\Text\Json\Serialization\JsonSerializer.Read.Stream.cs (1)
574if (readStack.Current.ReturnValue is { } returnValue)
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (8)
860dictionaryObjectValue[state.Current.JsonPropertyNameAsString!] = null; 866dictionaryObjectValue[state.Current.JsonPropertyNameAsString!] = value; 873dictionaryElementValue[state.Current.JsonPropertyNameAsString!] = value; 879EffectiveConverter.ReadElementAndSetProperty(propValue, state.Current.JsonPropertyNameAsString!, ref reader, Options, ref state); 904Debug.Assert(this == state.Current.JsonTypeInfo.ExtensionDataProperty); 949Debug.Assert(!state.Current.IsPopulating, "We've called TryGetPrePopulatedValue more than once"); 951state.Current.ReturnValue = value; 952state.Current.IsPopulating = value != null;
System\Text\Json\Serialization\Metadata\JsonPropertyInfoOfT.cs (9)
298ThrowHelper.ThrowJsonException_PropertySetterDisallowNull(Name, state.Current.JsonTypeInfo.Type); 306state.Current.MarkRequiredPropertyAsRead(this); 308else if (EffectiveConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 321ThrowHelper.ThrowJsonException_PropertySetterDisallowNull(Name, state.Current.JsonTypeInfo.Type); 328state.Current.MarkRequiredPropertyAsRead(this); 335state.Current.ReturnValue = obj; 350ThrowHelper.ThrowJsonException_PropertySetterDisallowNull(Name, state.Current.JsonTypeInfo.Type); 357state.Current.MarkRequiredPropertyAsRead(this); 382if (EffectiveConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null)
System\Text\Json\Serialization\ReadStack.cs (47)
36=> Current.HasParentObject ? Parent.JsonPropertyInfo : null; 105Current.JsonTypeInfo = jsonTypeInfo; 106Current.JsonPropertyInfo = jsonTypeInfo.PropertyInfoForTypeInfo; 107Current.NumberHandling = Current.JsonPropertyInfo.EffectiveNumberHandling; 108Current.CanContainMetadata = PreserveReferences || jsonTypeInfo.PolymorphicTypeResolver?.UsesTypeDiscriminators == true; 125JsonTypeInfo jsonTypeInfo = Current.JsonPropertyInfo?.JsonTypeInfo ?? Current.CtorArgumentState!.JsonParameterInfo!.JsonTypeInfo; 126JsonNumberHandling? numberHandling = Current.NumberHandling; 129_stack[_count - 1] = Current; 133Current.JsonTypeInfo = jsonTypeInfo; 134Current.JsonPropertyInfo = jsonTypeInfo.PropertyInfoForTypeInfo; 136Current.NumberHandling = numberHandling ?? Current.JsonPropertyInfo.EffectiveNumberHandling; 137Current.CanContainMetadata = PreserveReferences || jsonTypeInfo.PolymorphicTypeResolver?.UsesTypeDiscriminators == true; 146_stack[_count - 2] = Current; 193_stack[_count] = Current; 213Debug.Assert(Current.PolymorphicJsonTypeInfo == null); 214Debug.Assert(Current.PolymorphicSerializationState == PolymorphicSerializationState.None); 216Current.PolymorphicJsonTypeInfo = Current.JsonTypeInfo; 217Current.JsonTypeInfo = derivedJsonTypeInfo; 218Current.JsonPropertyInfo = derivedJsonTypeInfo.PropertyInfoForTypeInfo; 219Current.NumberHandling ??= Current.JsonPropertyInfo.NumberHandling; 220Current.PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryStarted; 232Debug.Assert(Current.PolymorphicJsonTypeInfo != null); 233Debug.Assert(Current.PolymorphicSerializationState == PolymorphicSerializationState.PolymorphicReEntrySuspended); 236(Current.JsonTypeInfo, Current.PolymorphicJsonTypeInfo) = (Current.PolymorphicJsonTypeInfo, Current.JsonTypeInfo); 237Current.PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryStarted; 238return Current.JsonTypeInfo.Converter; 246Debug.Assert(Current.PolymorphicJsonTypeInfo != null); 247Debug.Assert(Current.PolymorphicSerializationState == PolymorphicSerializationState.PolymorphicReEntryStarted); 250(Current.JsonTypeInfo, Current.PolymorphicJsonTypeInfo) = (Current.PolymorphicJsonTypeInfo, Current.JsonTypeInfo); 251Current.PolymorphicSerializationState = success ? PolymorphicSerializationState.None : PolymorphicSerializationState.PolymorphicReEntrySuspended; 385Debug.Assert(Current.JsonTypeInfo.UsesParameterizedConstructor); 386return Current.JsonTypeInfo; 392if (Current.JsonTypeInfo.UsesParameterizedConstructor) 394Current.CtorArgumentState ??= new(); 399private string DebuggerDisplay => $"Path = {JsonPath()}, Current = ConverterStrategy.{Current.JsonTypeInfo?.Converter.ConverterStrategy}, {Current.JsonTypeInfo?.Type.Name}";
System\Text\Json\ThrowHelper.Serialization.cs (15)
404state.Current.JsonPropertyName = propertyName.ToArray(); 481Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type; 575Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type; 682state.Current.JsonPropertyName = propertyName.ToArray(); 689state.Current.JsonPropertyName = propertyName.ToArray(); 708state.Current.JsonPropertyName = propertyName.ToArray(); 715state.Current.JsonPropertyName = propertyName.ToArray(); 723if (state.Current.IsProcessingDictionary()) 725state.Current.JsonPropertyNameAsString = reader.GetString(); 729state.Current.JsonPropertyName = propertyName.ToArray(); 756state.Current.JsonPropertyName = reader.HasValueSequence ? reader.ValueSequence.ToArray() : reader.ValueSpan.ToArray(); 768state.Current.JsonPropertyName = null; 801MetadataPropertyName name = JsonSerializer.GetMetadataPropertyName(propertyName, state.Current.BaseJsonTypeInfo.PolymorphicTypeResolver);