Bug: Standalone server throws 500 error when receiving concurrent requests #65

Closed
opened 2025-12-29 14:21:55 +01:00 by adam · 4 comments
Owner

Originally created by @FSatmar on GitHub (Feb 14, 2018).

Originally assigned to: @StefH on GitHub.

Hi,
I'm trying to use the WireMock Net as a standalone service but when I run multiple tests in parallel which call the admin api to create or delete mappings, the server often fails with a 500 error code. Any chance to to have this fixed?

The stacktrace:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Collections.Generic.List1.Enumerator.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at WireMock.Server.FluentMockServer.RegisterMapping(Mapping mapping)
at WireMock.Server.RespondWithAProvider.RespondWith(IResponseProvider provider)
at WireMock.Server.FluentMockServer.DeserializeAndAddMapping(String json, Nullable`1 guid)
at WireMock.Server.FluentMockServer.MappingsPost(RequestMessage requestMessage)

Originally created by @FSatmar on GitHub (Feb 14, 2018). Originally assigned to: @StefH on GitHub. Hi, I'm trying to use the WireMock Net as a standalone service but when I run multiple tests in parallel which call the admin api to create or delete mappings, the server often fails with a 500 error code. Any chance to to have this fixed? > The stacktrace: > System.InvalidOperationException: Collection was modified; enumeration operation may not execute. > at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) > at System.Collections.Generic.List`1.Enumerator.MoveNextRare() > at System.Collections.Generic.List`1.Enumerator.MoveNext() > at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) > at WireMock.Server.FluentMockServer.RegisterMapping(Mapping mapping) > at WireMock.Server.RespondWithAProvider.RespondWith(IResponseProvider provider) > at WireMock.Server.FluentMockServer.DeserializeAndAddMapping(String json, Nullable`1 guid) > at WireMock.Server.FluentMockServer.MappingsPost(RequestMessage requestMessage)
adam added the bug label 2025-12-29 14:21:55 +01:00
adam closed this issue 2025-12-29 14:21:55 +01:00
Author
Owner

@StefH commented on GitHub (Feb 14, 2018):

I will take a look.

@StefH commented on GitHub (Feb 14, 2018): I will take a look.
Author
Owner

@StefH commented on GitHub (Feb 14, 2018):

Can you please try version 1.0.3.2 ?

@StefH commented on GitHub (Feb 14, 2018): Can you please try version 1.0.3.2 ?
Author
Owner

@FSatmar commented on GitHub (Feb 15, 2018):

You are awesome! Thanks!

@FSatmar commented on GitHub (Feb 15, 2018): You are awesome! Thanks!
Author
Owner

@StefH commented on GitHub (Feb 15, 2018):

Ok. Nice to hear.

@StefH commented on GitHub (Feb 15, 2018): Ok. Nice to hear.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#65