5 writes to Current
System.Text.Json (5)
System\Text\Json\Serialization\WriteStack.cs (5)
204Current = default; 218Current = _stack[_count - _indexOffset]; 264Current = _stack[currentIndex]; 272Current = _stack[_count - _indexOffset]; 411AppendStackFrame(sb, ref Current);
174 references to Current
System.Text.Json (174)
System\Text\Json\Serialization\Converters\Collection\ArrayConverter.cs (5)
36int index = state.Current.EnumeratorIndex; 39if (elementConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 54state.Current.EnumeratorIndex = index; 58state.Current.EndCollectionElement(); 62state.Current.EnumeratorIndex = ++index;
System\Text\Json\Serialization\Converters\Collection\DictionaryDefaultConverter.cs (8)
28if (state.Current.CollectionEnumerator == null) 31state.Current.CollectionEnumerator = enumerator; 40enumerator = (IEnumerator<KeyValuePair<TKey, TValue>>)state.Current.CollectionEnumerator; 43JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 54if (state.Current.PropertyState < StackFramePropertyState.Name) 56state.Current.PropertyState = StackFramePropertyState.Name; 58_keyConverter.WriteAsPropertyNameCore(writer, key, options, state.Current.IsWritingExtensionDataProperty); 67state.Current.EndDictionaryEntry();
System\Text\Json\Serialization\Converters\Collection\DictionaryOfTKeyTValueConverter.cs (11)
32if (state.Current.CollectionEnumerator == null) 43enumerator = (Dictionary<TKey, TValue>.Enumerator)state.Current.CollectionEnumerator; 46JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 50if (!state.SupportContinuation && _valueConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 56_keyConverter.WriteAsPropertyNameCore(writer, key, options, state.Current.IsWritingExtensionDataProperty); 66state.Current.CollectionEnumerator = enumerator; 70if (state.Current.PropertyState < StackFramePropertyState.Name) 72state.Current.PropertyState = StackFramePropertyState.Name; 75_keyConverter.WriteAsPropertyNameCore(writer, key, options, state.Current.IsWritingExtensionDataProperty); 81state.Current.CollectionEnumerator = enumerator; 85state.Current.EndDictionaryEntry();
System\Text\Json\Serialization\Converters\Collection\IAsyncEnumerableOfTConverter.cs (9)
52if (state.Current.AsyncDisposable is null) 58state.Current.AsyncDisposable = enumerator; 76Debug.Assert(state.Current.AsyncDisposable is IAsyncEnumerator<TElement>); 77enumerator = (IAsyncEnumerator<TElement>)state.Current.AsyncDisposable; 79if (state.Current.AsyncEnumeratorIsPendingCompletion) 84state.Current.AsyncEnumeratorIsPendingCompletion = false; 105state.Current.AsyncDisposable = null; 121state.Current.EndCollectionElement(); 131state.Current.AsyncEnumeratorIsPendingCompletion = true;
System\Text\Json\Serialization\Converters\Collection\IDictionaryConverter.cs (9)
45if (state.Current.CollectionEnumerator == null) 48state.Current.CollectionEnumerator = enumerator; 56enumerator = (IDictionaryEnumerator)state.Current.CollectionEnumerator; 59JsonTypeInfo typeInfo = state.Current.JsonTypeInfo; 69if (state.Current.PropertyState < StackFramePropertyState.Name) 71state.Current.PropertyState = StackFramePropertyState.Name; 77_keyConverter.WriteAsPropertyNameCore(writer, keyString, options, state.Current.IsWritingExtensionDataProperty); 83_valueConverter.WriteAsPropertyNameCore(writer, key, options, state.Current.IsWritingExtensionDataProperty); 93state.Current.EndDictionaryEntry();
System\Text\Json\Serialization\Converters\Collection\IEnumerableConverter.cs (4)
46if (state.Current.CollectionEnumerator == null) 49state.Current.CollectionEnumerator = enumerator; 57enumerator = state.Current.CollectionEnumerator; 74state.Current.EndCollectionElement();
System\Text\Json\Serialization\Converters\Collection\IEnumerableDefaultConverter.cs (5)
22if (state.Current.CollectionEnumerator == null) 25state.Current.CollectionEnumerator = enumerator; 34Debug.Assert(state.Current.CollectionEnumerator is IEnumerator<TElement>); 35enumerator = (IEnumerator<TElement>)state.Current.CollectionEnumerator; 52state.Current.EndCollectionElement();
System\Text\Json\Serialization\Converters\Collection\IListConverter.cs (5)
44int index = state.Current.EnumeratorIndex; 47if (elementConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 62state.Current.EnumeratorIndex = index; 66state.Current.EndCollectionElement(); 70state.Current.EnumeratorIndex = ++index;
System\Text\Json\Serialization\Converters\Collection\JsonCollectionConverter.cs (10)
57Debug.Assert(state.Current.JsonPropertyInfo != null); 58return (JsonConverter<TElement>)state.Current.JsonPropertyInfo.EffectiveConverter; 306JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 308if (!state.Current.ProcessedStartToken) 310state.Current.ProcessedStartToken = true; 316state.Current.MetadataPropertyName = JsonSerializer.WriteMetadataForCollection(this, ref state, writer); 321state.Current.JsonPropertyInfo = jsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo; 327if (!state.Current.ProcessedEndToken) 329state.Current.ProcessedEndToken = true; 332if (state.Current.MetadataPropertyName != 0)
System\Text\Json\Serialization\Converters\Collection\JsonDictionaryConverter.cs (6)
346JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 348if (!state.Current.ProcessedStartToken) 350state.Current.ProcessedStartToken = true; 361state.Current.JsonPropertyInfo = jsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo; 367if (!state.Current.ProcessedEndToken) 369state.Current.ProcessedEndToken = true;
System\Text\Json\Serialization\Converters\Collection\ListOfTConverter.cs (5)
41int index = state.Current.EnumeratorIndex; 44if (elementConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 59state.Current.EnumeratorIndex = index; 63state.Current.EndCollectionElement(); 67state.Current.EnumeratorIndex = ++index;
System\Text\Json\Serialization\Converters\Collection\ReadOnlyMemoryConverter.cs (5)
54int index = state.Current.EnumeratorIndex; 58if (elementConverter.CanUseDirectReadOrWrite && state.Current.NumberHandling == null) 72state.Current.EnumeratorIndex = index; 76state.Current.EndCollectionElement(); 80state.Current.EnumeratorIndex = ++index;
System\Text\Json\Serialization\Converters\Collection\StackOrQueueConverter.cs (4)
46if (state.Current.CollectionEnumerator == null) 49state.Current.CollectionEnumerator = enumerator; 57enumerator = state.Current.CollectionEnumerator; 74state.Current.EndCollectionElement();
System\Text\Json\Serialization\Converters\FSharp\FSharpOptionConverter.cs (2)
63state.Current.JsonPropertyInfo = state.Current.JsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo;
System\Text\Json\Serialization\Converters\FSharp\FSharpValueOptionConverter.cs (2)
64state.Current.JsonPropertyInfo = state.Current.JsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo;
System\Text\Json\Serialization\Converters\JsonMetadataServicesConverter.cs (2)
53JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 58!JsonHelpers.RequiresSpecialNumberHandlingOnWrite(state.Current.NumberHandling) &&
System\Text\Json\Serialization\Converters\Object\ObjectDefaultConverter.cs (24)
322JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; 343state.Current.JsonPropertyInfo = jsonPropertyInfo; 344state.Current.NumberHandling = jsonPropertyInfo.EffectiveNumberHandling; 350state.Current.EndProperty(); 359state.Current.JsonPropertyInfo = extensionDataProperty; 360state.Current.NumberHandling = extensionDataProperty.EffectiveNumberHandling; 365state.Current.EndProperty(); 372if (!state.Current.ProcessedStartToken) 383state.Current.ProcessedStartToken = true; 387while (state.Current.EnumeratorIndex < propertyCache.Length) 389JsonPropertyInfo jsonPropertyInfo = propertyCache[state.Current.EnumeratorIndex]; 392state.Current.JsonPropertyInfo = jsonPropertyInfo; 393state.Current.NumberHandling = jsonPropertyInfo.EffectiveNumberHandling; 401state.Current.EndProperty(); 402state.Current.EnumeratorIndex++; 411state.Current.EnumeratorIndex++; 416if (state.Current.EnumeratorIndex == propertyCache.Length) 422state.Current.JsonPropertyInfo = extensionDataProperty; 423state.Current.NumberHandling = extensionDataProperty.EffectiveNumberHandling; 430state.Current.EndProperty(); 431state.Current.EnumeratorIndex++; 440state.Current.EnumeratorIndex++; 444if (!state.Current.ProcessedEndToken) 446state.Current.ProcessedEndToken = true;
System\Text\Json\Serialization\Converters\Value\NullableConverter.cs (2)
58state.Current.JsonPropertyInfo = state.Current.JsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo;
System\Text\Json\Serialization\JsonConverter.MetadataHandling.cs (6)
78switch (state.Current.PolymorphicSerializationState) 88jsonTypeInfo = state.Current.InitializePolymorphicReEntry(runtimeType, options); 98polymorphicConverter = state.Current.InitializePolymorphicReEntry(derivedJsonTypeInfo); 115state.Current.PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryNotFound; 122polymorphicConverter = state.Current.ResumePolymorphicReEntry(); 158state.Current.IsPushedReferenceForCycleDetection = state.CurrentDepth > 0;
System\Text\Json\Serialization\JsonConverterOfT.cs (20)
348if (state.Current.NumberHandling != null && IsInternalConverterForNumberType) 350WriteNumberWithCustomHandling(writer, value, state.Current.NumberHandling.Value); 375state.Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted) 395state.Current.ExitPolymorphicConverter(success); 399if (state.Current.IsPushedReferenceForCycleDetection) 402state.Current.IsPushedReferenceForCycleDetection = false; 412JsonTypeInfo originalJsonTypeInfo = state.Current.JsonTypeInfo; 415Debug.Assert(Type == state.Current.JsonTypeInfo.Type); 421Debug.Assert(state.Current.OriginalDepth == 0); 422state.Current.OriginalDepth = writer.CurrentDepth; 429VerifyWrite(state.Current.OriginalDepth, writer); 434if (success && state.Current.IsPushedReferenceForCycleDetection) 437state.Current.IsPushedReferenceForCycleDetection = false; 440Debug.Assert(ReferenceEquals(originalJsonTypeInfo, state.Current.JsonTypeInfo)); 477Debug.Assert(state.Current.OriginalDepth == 0); 478state.Current.OriginalDepth = writer.CurrentDepth; 482state.Current.IsWritingExtensionDataProperty = true; 483state.Current.JsonPropertyInfo = state.Current.JsonTypeInfo.ElementTypeInfo!.PropertyInfoForTypeInfo; 488VerifyWrite(state.Current.OriginalDepth, writer);
System\Text\Json\Serialization\Metadata\JsonPropertyInfoOfT.cs (5)
214ThrowHelper.ThrowJsonException_PropertyGetterDisallowNull(Name, state.Current.JsonTypeInfo.Type); 219if (state.Current.PropertyState < StackFramePropertyState.Name) 221state.Current.PropertyState = StackFramePropertyState.Name; 241if (state.Current.PropertyState < StackFramePropertyState.Name) 243state.Current.PropertyState = StackFramePropertyState.Name;
System\Text\Json\Serialization\WriteStack.cs (23)
154Current.JsonTypeInfo = jsonTypeInfo; 155Current.JsonPropertyInfo = jsonTypeInfo.PropertyInfoForTypeInfo; 156Current.NumberHandling = Current.JsonPropertyInfo.EffectiveNumberHandling; 180Debug.Assert(Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted); 181return _count == 0 ? Current.JsonTypeInfo : Current.JsonPropertyInfo!.JsonTypeInfo; 188Debug.Assert(Current.PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntrySuspended); 190if (_count == 0 && Current.PolymorphicSerializationState == PolymorphicSerializationState.None) 199JsonTypeInfo jsonTypeInfo = Current.GetNestedJsonTypeInfo(); 200JsonNumberHandling? numberHandling = Current.NumberHandling; 203_stack[_count - _indexOffset] = Current; 207Current.JsonTypeInfo = jsonTypeInfo; 208Current.JsonPropertyInfo = jsonTypeInfo.PropertyInfoForTypeInfo; 210Current.NumberHandling = numberHandling ?? Current.JsonPropertyInfo.EffectiveNumberHandling; 263_stack[currentIndex + 1] = Current; 314Debug.Assert(Current.AsyncDisposable is null); 315DisposeFrame(Current.CollectionEnumerator, ref exception); 353exception = await DisposeFrame(Current.CollectionEnumerator, Current.AsyncDisposable, exception).ConfigureAwait(false); 446private string DebuggerDisplay => $"Path = {PropertyPath()} Current = ConverterStrategy.{Current.JsonPropertyInfo?.EffectiveConverter.ConverterStrategy}, {Current.JsonTypeInfo?.Type.Name}";
System\Text\Json\ThrowHelper.Serialization.cs (2)
603Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;