@@ -175,7 +175,7 @@ public Task BuildAddressExceptionsDisabledTest()
175175 city );
176176}
177177```
178- <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L185-L201 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationSample_CaptureExceptionsFalse ' title =' Start of snippet ' >anchor</a ></sup >
178+ <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L214-L230 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationSample_CaptureExceptionsFalse ' title =' Start of snippet ' >anchor</a ></sup >
179179<!-- endSnippet -->
180180
181181
@@ -215,13 +215,32 @@ public class CombinationResultsConverter :
215215
216216 var keyValues = new string [items .Count , keysLength ];
217217
218+ // Keys repeat across rows (a column only has as many distinct values as
219+ // its input list), so cache the computed name per distinct key value.
220+ var nameCache = new Dictionary <object , string >();
221+ string ? nullName = null ;
222+
218223 for (var itemIndex = 0 ; itemIndex < items .Count ; itemIndex ++ )
219224 {
220225 var item = items [itemIndex ];
221226 for (var keyIndex = 0 ; keyIndex < keysLength ; keyIndex ++ )
222227 {
223228 var key = item .Keys [keyIndex ];
224- var name = VerifierSettings .GetNameForParameter (key , writer .Counter , pathFriendly : false );
229+ string name ;
230+ if (key == null )
231+ {
232+ name = nullName ??= VerifierSettings .GetNameForParameter (null , writer .Counter , pathFriendly : false );
233+ }
234+ else if (nameCache .TryGetValue (key , out var cached ))
235+ {
236+ name = cached ;
237+ }
238+ else
239+ {
240+ name = VerifierSettings .GetNameForParameter (key , writer .Counter , pathFriendly : false );
241+ nameCache [key ] = name ;
242+ }
243+
225244 keyValues [itemIndex , keyIndex ] = name ;
226245 var currentKeyLength = maxKeyLengths [keyIndex ];
227246 if (name .Length > currentKeyLength )
@@ -353,7 +372,7 @@ public class CombinationResultsConverter :
353372 }
354373}
355374```
356- <sup ><a href =' /src/Verify/Combinations/CombinationResultsConverter.cs#L1-L166 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationResultsConverter.cs ' title =' Start of snippet ' >anchor</a ></sup >
375+ <sup ><a href =' /src/Verify/Combinations/CombinationResultsConverter.cs#L1-L185 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationResultsConverter.cs ' title =' Start of snippet ' >anchor</a ></sup >
357376<!-- endSnippet -->
358377
359378
@@ -378,7 +397,7 @@ class CustomCombinationConverter :
378397 string .Join (" , " , keys .Select (_ => _ .Value ));
379398}
380399```
381- <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L231-L240 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationSample_CustomSerializationConverter ' title =' Start of snippet ' >anchor</a ></sup >
400+ <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L260-L269 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationSample_CustomSerializationConverter ' title =' Start of snippet ' >anchor</a ></sup >
382401<!-- endSnippet -->
383402
384403Full control of serialization can be achieved by inheriting from ` WriteOnlyJsonConverter<CombinationResults> ` .
@@ -397,7 +416,7 @@ static CustomCombinationConverter customConverter = new();
397416public static void Init () =>
398417 VerifierSettings .AddExtraSettings (_ => _ .Converters .Insert (0 , customConverter ));
399418```
400- <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L203-L211 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationSample_CustomSerializationModuleInitializer ' title =' Start of snippet ' >anchor</a ></sup >
419+ <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L232-L240 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CombinationSample_CustomSerializationModuleInitializer ' title =' Start of snippet ' >anchor</a ></sup >
401420<!-- endSnippet -->
402421
403422
@@ -528,5 +547,5 @@ Headers can be enabled globally:
528547public static void EnableIncludeHeaders () =>
529548 CombinationSettings .IncludeHeaders ();
530549```
531- <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L243-L249 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GlobalCombinationHeader ' title =' Start of snippet ' >anchor</a ></sup >
550+ <sup ><a href =' /src/StaticSettingsTests/CombinationTests.cs#L272-L278 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GlobalCombinationHeader ' title =' Start of snippet ' >anchor</a ></sup >
532551<!-- endSnippet -->
0 commit comments