Skip to content

JsonExtensionDataAttribute not working with custom overflow converters in source gen #87005

Description

@eiriktsarpalis

The following unit test:

[Theory]
[InlineData(typeof(Dictionary<string,object>),typeof(DictionaryOverflowConverter),typeof(object))]
[InlineData(typeof(Dictionary<string,JsonElement>),typeof(JsonElementOverflowConverter),typeof(JsonElement))]
[InlineData(typeof(CustomOverflowDictionary<object>),typeof(CustomObjectDictionaryOverflowConverter),typeof(object))]
[InlineData(typeof(CustomOverflowDictionary<JsonElement>),typeof(CustomJsonElementDictionaryOverflowConverter),typeof(JsonElement))]
publicvoidExtensionProperty_IgnoresCustomSerializerWithOptions(TypeoverflowType,TypeconverterType,TypeelementType)
{
typeof(ExtensionDataTests)
.GetMethod(nameof(ExtensionProperty_IgnoresCustomSerializerWithOptionsInternal),BindingFlags.Static|BindingFlags.NonPublic)
.MakeGenericMethod(overflowType,elementType,converterType)
.Invoke(null,null);
}

hardcodes testing to the reflection serializer. Switching the test to use source gen causes it to fail.

Discovered while investigating #86975.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions