Steps to reproduce
It happens randomly. Most of the time it works. Sometimes it fails and no other Invoke-RestMethod is possible after.
1..10 | ForEach-Object -Parallel { Invoke-RestMethod -Uri "www.google.com" -Headers @{
"method"="GET"
"scheme"="https"
}
} -ThrottleLimit 3
Expected behavior
To work everytime without the concurrent update error.
Actual behavior
Sometimes it returns the error bellow, and no further Invoke-RestMethod is possible in the session (it always returns the very same error) :
Invoke-RestMethod: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Environment data
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Steps to reproduce
It happens randomly. Most of the time it works. Sometimes it fails and no other Invoke-RestMethod is possible after.
Expected behavior
Actual behavior
Environment data