Skip to content

Commit d6e67a4

Browse files
reneemundieRenee Mundiemorganleroi
authored
fix(clients): InvalidOperationException in C# Fill() due to unsafe dictionary enumeration (#4820)
Co-authored-by: Renee Mundie <reneemundie@PEO-M3P-RM.local> Co-authored-by: Morgan Leroi <morgan.leroi@gmail.com>
1 parent 3694a49 commit d6e67a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Http/HttpRequestHeadersExtensions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Linq;
23
using System.Net.Http.Headers;
34
using Algolia.Search.Utils;
45

@@ -14,7 +15,7 @@ internal static class HttpRequestHeadersExtensions
1415
/// <returns></returns>
1516
internal static void Fill(this HttpRequestHeaders headers, IDictionary<string, string> dictionary)
1617
{
17-
foreach (var header in dictionary)
18+
foreach (var header in dictionary.ToList())
1819
{
1920
headers.TryAddWithoutValidation(header.Key, header.Value);
2021
}

0 commit comments

Comments
 (0)