Skip to content

Conversation

reneemundie
Copy link
Contributor

This PR fixes a concurrency issue where HttpRequestHeadersExtensions.Fill() enumerates a shared IDictionary<string, string> that may be modified by another thread, resulting in:

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

This happens during high-concurrency scenarios, like parallel calls to SaveObjectsAsync, when request headers are reused across threads.

Fix: Convert the dictionary to a list before enumeration using .ToList() to ensure thread-safe iteration.

This change does not alter behaviour but protects against intermittent runtime exceptions.

Related issue: [bug]: InvalidOperationException: Collection was modified; enumeration operation may not execute.

Copy link

github-actions bot commented May 6, 2025

Thanks for contributing to our API clients! Sorry to close your PR, but this repository is fully generated, you can port your changes to the API Clients Automation repository. If you need some guidance, feel free to open an issue or read our contribution guide.

@github-actions github-actions bot closed this May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant