internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, ref ReadStack state, out T?value) { JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; if (_converterStrategy == ConverterStrategy.Object && jsonTypeInfo.PropertyCache == null) { jsonTypeInfo.InitializePropCache(); } return(Converter.OnTryRead(ref reader, typeToConvert, options, ref state, out value)); }
internal override bool OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, ref WriteStack state) { JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; Debug.Assert(options == jsonTypeInfo.Options); if (!state.SupportContinuation && jsonTypeInfo is JsonTypeInfo <T> info && info.SerializeHandler != null && info.Options._context?.CanUseSerializationLogic == true) { info.SerializeHandler(writer, value); return(true); } if (_converterStrategy == ConverterStrategy.Object && jsonTypeInfo.PropertyCache == null) { jsonTypeInfo.InitializePropCache(); } return(Converter.OnTryWrite(writer, value, options, ref state)); }