/// </summary>
private int _continuationCount;
- // State cache when deserializing objects with parameterized constructors.
- private List<ArgumentState>? _ctorArgStateCache;
-
/// <summary>
/// Bytes consumed in the current loop.
/// </summary>
Current = _stack[_count - 1];
}
}
-
- SetConstructorArgumentState();
}
/// <summary>
{
if (Current.JsonTypeInfo.Converter.ConstructorIsParameterized)
{
- // A zero index indicates a new stack frame.
- if (Current.CtorArgumentStateIndex == 0)
- {
- _ctorArgStateCache ??= new List<ArgumentState>();
-
- var newState = new ArgumentState();
- _ctorArgStateCache.Add(newState);
-
- (Current.CtorArgumentStateIndex, Current.CtorArgumentState) = (_ctorArgStateCache.Count, newState);
- }
- else
- {
- Current.CtorArgumentState = _ctorArgStateCache![Current.CtorArgumentStateIndex - 1];
- }
+ Current.CtorArgumentState ??= new();
}
}
public List<PropertyRef>? PropertyRefCache;
// Holds relevant state when deserializing objects with parameterized constructors.
- public int CtorArgumentStateIndex;
public ArgumentState? CtorArgumentState;
// Whether to use custom number handling.