You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intermittent exception when calling WireMockServer.FindLogEntries:
Message:
System.ArgumentException : Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
Call FindLogEntries while entries are added to source collection _options.LogEntries.
Other related info
It looks like the generic Enumerable.ToArray implementation called in public IReadOnlyList LogEntries => _options.LogEntries.ToArray(); for getting a snapshot of the log entries does not like it when the source collection grows while copying the items. A dedicated threadsafe ToArray implementation on ConcurrentObservableCollection might be the solution.
Describe the bug
Intermittent exception when calling
WireMockServer.FindLogEntries
:Message:
Stack Trace:
This only seems to happen when log entries are being added to WireMockMiddlewareOptions.LogEntries during the call to
FindLogEntries
.Expected behavior:
No exception should be thrown.
Test to reproduce
FindLogEntries
while entries are added to source collection_options.LogEntries
.Other related info
It looks like the generic
Enumerable.ToArray
implementation called in public IReadOnlyList LogEntries => _options.LogEntries.ToArray(); for getting a snapshot of the log entries does not like it when the source collection grows while copying the items. A dedicated threadsafeToArray
implementation onConcurrentObservableCollection
might be the solution.Related: #1234
Using version 1.7.2
The text was updated successfully, but these errors were encountered: