Skip to content

STJ Source Generator generates invalid code with value tuples #58137

Description

@aromaa

Description

When value tuples are given field names they are also included in the serializer and end up generating compile errors.

Repo

internal static class Program
{
	private static void Main()
	{
		JsonSerializer.Serialize(new Test(default), typeof(Test), JsonContext.Default);
	}
}

internal sealed record Test((string Value1, string Value2) ValueTuple);

[JsonSerializable(typeof(Test))]
internal sealed partial class JsonContext : JsonSerializerContext
{
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions