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