System.ValueTuple does not serialize properly. #17454
Labels
Area-Compilers
Feature - Tuples
Tuples
Question
Resolution-By Design
The behavior reported in the issue matches the current design
Milestone
this works fine:
new BinaryFormatter().Serialize(File.Create(Path.GetTempFileName()), new System.Tuple<int, int>(0,0));
this throws "is not marked as serializable":
new BinaryFormatter().Serialize(File.Create(Path.GetTempFileName()), (lat: 0, lon: 0));
In WebAPI:
[Route("api/geocoords/usa/zipcodes/{zip}")] public (double lat, double lon) GetZipCoords(int zip) => (0, 0);
returns:
{"Item1":0.0,"Item2":0.0}
instead of:
{"lat":0.0,"lon":0.0}
Which as you can probably guess is rather disappointing that the new Tuples are almost useless for daily usage in this context.
The text was updated successfully, but these errors were encountered: