diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Http/HttpRequestHeadersExtensions.cs b/clients/algoliasearch-client-csharp/algoliasearch/Http/HttpRequestHeadersExtensions.cs
index 7b56a5ead78..b37c772ce07 100644
--- a/clients/algoliasearch-client-csharp/algoliasearch/Http/HttpRequestHeadersExtensions.cs
+++ b/clients/algoliasearch-client-csharp/algoliasearch/Http/HttpRequestHeadersExtensions.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using System.Net.Http.Headers;
using Algolia.Search.Utils;
@@ -14,7 +15,7 @@ internal static class HttpRequestHeadersExtensions
///
internal static void Fill(this HttpRequestHeaders headers, IDictionary dictionary)
{
- foreach (var header in dictionary)
+ foreach (var header in dictionary.ToList())
{
headers.TryAddWithoutValidation(header.Key, header.Value);
}