@@ -149,37 +149,37 @@ public void RoundtripJsonElement(string json)
149149 [ Fact ]
150150 public virtual void RoundTripValueTuple ( )
151151 {
152- bool isIncludeFieldsEnabled = DefaultContext . IsIncludeFieldsEnabled ;
153-
154152 var tuple = ( Label1 : "string" , Label2 : 42 , true ) ;
155- string expectedJson = isIncludeFieldsEnabled
156- ? "{\" Item1\" :\" string\" ,\" Item2\" :42,\" Item3\" :true}"
157- : "{}" ;
153+ // Tuples now always serialize as objects with Item1, Item2, Item3 regardless of IncludeFields
154+ string expectedJson = "{\" Item1\" :\" string\" ,\" Item2\" :42,\" Item3\" :true}" ;
158155
159156 string json = JsonSerializer . Serialize ( tuple , DefaultContext . ValueTupleStringInt32Boolean ) ;
160157 Assert . Equal ( expectedJson , json ) ;
161158
162159 if ( DefaultContext . JsonSourceGenerationMode == JsonSourceGenerationMode . Serialization )
163160 {
164161 // Deserialization not supported in fast path serialization only mode
165- // but if there are no fields we won't throw because we throw on the property lookup
166- if ( isIncludeFieldsEnabled )
167- {
168- Assert . Throws < InvalidOperationException > ( ( ) => JsonSerializer . Deserialize ( json , DefaultContext . ValueTupleStringInt32Boolean ) ) ;
169- }
170- else
171- {
172- ( string , int , bool ) obj = JsonSerializer . Deserialize ( json , DefaultContext . ValueTupleStringInt32Boolean ) ;
173- Assert . Equal ( default ( ( string , int , bool ) ) , obj ) ;
174- }
162+ Assert . Throws < InvalidOperationException > ( ( ) => JsonSerializer . Deserialize ( json , DefaultContext . ValueTupleStringInt32Boolean ) ) ;
175163 }
176164 else
177165 {
178166 var deserializedTuple = JsonSerializer . Deserialize ( json , DefaultContext . ValueTupleStringInt32Boolean ) ;
179- Assert . Equal ( isIncludeFieldsEnabled ? tuple : default , deserializedTuple ) ;
167+ Assert . Equal ( tuple , deserializedTuple ) ;
180168 }
181169 }
182170
171+ [ Fact ]
172+ public virtual void LongValueTupleSerializes ( )
173+ {
174+ // Test that long tuples (> 7 elements) flatten the Rest field properly
175+ var longTuple = ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ) ;
176+ string json = JsonSerializer . Serialize ( longTuple ) ;
177+ // Should serialize as Item1 through Item10, not nested Rest objects
178+ Assert . Contains ( "\" Item1\" :1" , json ) ;
179+ Assert . Contains ( "\" Item10\" :10" , json ) ;
180+ Assert . DoesNotContain ( "\" Rest\" " , json ) ;
181+ }
182+
183183 [ Fact ]
184184 public virtual void RoundTripWithCustomConverter_Class ( )
185185 {
0 commit comments