Flurl icon indicating copy to clipboard operation
Flurl copied to clipboard

Collection was modified; enumeration operation may not execute.

Open bazarniy opened this issue 7 months ago • 1 comments

Hey guys! I have multithreading exception for you.

FlurlClientCache bangs in CreateBuilder() foreach with "Collection was modified; enumeration operation may not execute." when another thread calls WithDefaults method. Please make collection copy before call foreach.

I am understand that in real world we make just one call of singleton WithDefaults per application. But here I have integration tests who recreates container and have multiple calls in parralel (add defaults + create client). And I understand that I should call it just one time and I fix it in my code, but it is bad to have multithreading exceptions in singleton

bazarniy avatar Jun 29 '24 09:06 bazarniy