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
It looks like 1.6.11 has a regression in method WireMockServer.FindLogEntries. After NuGet upgrade, this exception is sometimes thrown:
---> System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
at System.Array.CopyImpl(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at WireMock.Server.WireMockServer.FindLogEntries(IRequestMatcher[] matchers)
This seems to happen intermittently, most likely due to concurrency.
Looking at this change , I suspect that the apparent regression is caused by the change from ToList() to ToArray().
When new log entries are added to _options.LogEntries while creating the array, the input collection becomes larger than the allocated array during copying. Previously the target list could grow, but the array cannot.
Expected behavior:
No exception.
Test to reproduce
Add items to _options.LogEntries during the call to _options.LogEntries.ToArray()
Other related info
Using .NET 9 SDK and Runtime
The text was updated successfully, but these errors were encountered:
Describe the bug
It looks like 1.6.11 has a regression in method
WireMockServer.FindLogEntries
. After NuGet upgrade, this exception is sometimes thrown:This seems to happen intermittently, most likely due to concurrency.
Looking at this change , I suspect that the apparent regression is caused by the change from
ToList()
toToArray()
.When new log entries are added to
_options.LogEntries
while creating the array, the input collection becomes larger than the allocated array during copying. Previously the target list could grow, but the array cannot.Expected behavior:
No exception.
Test to reproduce
Add items to
_options.LogEntries
during the call to_options.LogEntries.ToArray()
Other related info
Using .NET 9 SDK and Runtime
The text was updated successfully, but these errors were encountered: