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