/// <summary> /// Configures the next frame for a continuation of a polymorphic converter. /// </summary> public JsonConverter ResumePolymorphicReEntry() { Debug.Assert(PolymorphicSerializationState == PolymorphicSerializationState.PolymorphicReEntrySuspended); Debug.Assert(PolymorphicJsonTypeInfo is not null); PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryStarted; return(PolymorphicJsonTypeInfo.ConverterBase); }
public void EndProperty() { JsonPropertyInfo = null !; JsonPropertyNameAsString = null; PropertyState = StackFramePropertyState.None; PolymorphicSerializationState = PolymorphicSerializationState.None; }
/// <summary> /// Configures the next stack frame for a polymorphic converter. /// </summary> public JsonConverter InitializePolymorphicReEntry(JsonTypeInfo derivedJsonTypeInfo) { Debug.Assert(PolymorphicSerializationState == PolymorphicSerializationState.None); PolymorphicJsonTypeInfo = derivedJsonTypeInfo.PropertyInfoForTypeInfo; PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryStarted; return(PolymorphicJsonTypeInfo.ConverterBase); }
/// <summary> /// Configures the next stack frame for a polymorphic converter. /// </summary> public JsonConverter InitializePolymorphicReEntry(Type runtimeType, JsonSerializerOptions options) { Debug.Assert(PolymorphicSerializationState == PolymorphicSerializationState.None); // For perf, avoid the dictionary lookup in GetOrAddJsonTypeInfo() for every element of a collection // if the current element is the same type as the previous element. if (PolymorphicJsonTypeInfo?.PropertyType != runtimeType) { JsonTypeInfo typeInfo = options.GetOrAddJsonTypeInfo(runtimeType); PolymorphicJsonTypeInfo = typeInfo.PropertyInfoForTypeInfo; } PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryStarted; return(PolymorphicJsonTypeInfo.ConverterBase); }
public void EndDictionaryEntry() { PropertyState = StackFramePropertyState.None; PolymorphicSerializationState = PolymorphicSerializationState.None; }
public void EndCollectionElement() { PolymorphicSerializationState = PolymorphicSerializationState.None; }
/// <summary> /// Updates frame state after a polymorphic converter has returned. /// </summary> public void ExitPolymorphicConverter(bool success) { PolymorphicSerializationState = success ? PolymorphicSerializationState.None : PolymorphicSerializationState.PolymorphicReEntrySuspended; }
public void ExitPolymorphicConverter(bool success) { Debug.Assert(PolymorphicSerializationState == PolymorphicSerializationState.PolymorphicReEntryStarted); PolymorphicSerializationState = success ? PolymorphicSerializationState.None : PolymorphicSerializationState.PolymorphicReEntrySuspended; }
public void EnterPolymorphicConverter() { Debug.Assert(PolymorphicSerializationState != PolymorphicSerializationState.PolymorphicReEntryStarted); PolymorphicSerializationState = PolymorphicSerializationState.PolymorphicReEntryStarted; }