Skip to content

AOT formatter should be more flexible for member/parameter types #1851

Description

@AArnott

The generated AOT formatter is invalid for the following class:

[SerializationConstructor]
public DiscoveredParts(IEnumerable<ComposablePartDefinition> parts, IEnumerable<PartDiscoveryException> discoveryErrors)
{
    this.Parts = ImmutableHashSet.CreateRange(parts);
    this.DiscoveryErrors = ImmutableList.CreateRange(discoveryErrors);
}

[Key(0)]
public ImmutableHashSet<ComposablePartDefinition> Parts { get; private set; }

[Key(1)]
public ImmutableList<PartDiscoveryException> DiscoveryErrors { get; private set; }

The formatter is correct when the parameter types match the member types, but it would be great if the formatter could deal with the parameter types being different from the member types, particularly when the member type is assignable to the parameter type (although the reverse would also be great to support, where the deserializer would just create the more derived type).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions