mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
__admin/requests - "Collection was modified" exception #197
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gregoks on GitHub (Jul 31, 2019).
Originally assigned to: @StefH on GitHub.
Hi,
When I accesed /__admin/requests I got the following exception:
{"Status":"{"ClassName":"System.InvalidOperationException","Message":"Collection was modified; enumeration operation may not execute.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at System.Collections.Generic.List
1.Enumerator.MoveNextRare()\\r\\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)\r\n at WireMock.Server.FluentMockServer.ToJson[T](T result, Boolean keepNullValues)\r\n at WireMock.ResponseProviders.DynamicResponseProvider.ProvideResponseAsync(RequestMessage requestMessage, IFluentMockServerSettings settings)\r\n at WireMock.Mapping.ResponseToAsync(RequestMessage requestMessage)\r\n at WireMock.Owin.WireMockMiddleware.InvokeInternal(HttpContext ctx)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2146233079,"Source":"System.Private.CoreLib","WatsonBuckets":null}"}Can you please check?
Thanks,
Greg
@StefH commented on GitHub (Jul 31, 2019):
I'll take a look, probably I need to deep clone this collection when it's requested, so that you get a copy and not a reference.
@gregoks commented on GitHub (Jul 31, 2019):
thanks @StefH !
@StefH commented on GitHub (Jul 31, 2019):
Can you try new version from MyGet?
WireMock.Net.1.0.26-ci-11549
@gregoks commented on GitHub (Aug 1, 2019):
Sure, I'll run it for few days and see if it happens again since it doesnt happen always..
@gregoks commented on GitHub (Aug 9, 2019):
Havent seen this error since the fix.
@StefH commented on GitHub (Aug 10, 2019):
I'll merge that PR to master and create a new NuGet.
In case this happens again, please open a new issue.