diff --git a/src/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs b/src/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs index 4d45329caa0d..977273ee60df 100644 --- a/src/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs +++ b/src/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs @@ -435,7 +435,7 @@ public static ulong GetKey(ReadOnlySpan propertyName) public static Type GetElementType(Type propertyType, Type parentType, MemberInfo memberInfo, JsonSerializerOptions options) { // We want to handle as the implemented collection type, if applicable. - Type implementedType = GetImplementedCollectionType(parentType, propertyType, null, out _, options); + Type implementedType = GetImplementedCollectionType(parentType, propertyType, propertyInfo: null, out _, options); if (!typeof(IEnumerable).IsAssignableFrom(implementedType)) { @@ -484,7 +484,7 @@ public static ClassType GetClassType(Type type, JsonSerializerOptions options) Debug.Assert(type != null); // We want to handle as the implemented collection type, if applicable. - Type implementedType = GetImplementedCollectionType(typeof(object), type, null, out _, options); + Type implementedType = GetImplementedCollectionType(typeof(object), type, propertyInfo: null, out _, options); if (implementedType.IsGenericType && implementedType.GetGenericTypeDefinition() == typeof(Nullable<>)) { diff --git a/src/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs b/src/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs index e2fabcb460da..ff71f9dc2b1f 100644 --- a/src/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs +++ b/src/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs @@ -355,7 +355,14 @@ internal JsonPropertyInfo GetJsonPropertyInfoFromClassInfo(Type objectType, Json { if (!_objectJsonProperties.TryGetValue(objectType, out JsonPropertyInfo propertyInfo)) { - propertyInfo = JsonClassInfo.CreateProperty(objectType, objectType, objectType, null, typeof(object), null, options); + propertyInfo = JsonClassInfo.CreateProperty( + objectType, + objectType, + objectType, + propertyInfo: null, + typeof(object), + converter: null, + options); _objectJsonProperties[objectType] = propertyInfo; }