Collection was modified; enumeration operation may not execute
Hi,
i upload several files in own threads to Amazon. After a few request i get on this line of code (i use vb.net) an error
Dim feedOutput = amazonConnection.Feed.GetFeed(feedresultTXT)
System.InvalidOperationException: "Collection was modified; enumeration operation may not execute."
based on my knowledge, each thread should have his own variable an so it can't be, that one thread is overwriting the data of another thread?
Any idea, where the problem came from?
As the error came from above line, which is based on your c# api, i can't even access the resources, which you use there....
After importing your project into Visual Studio i can point out the exact line of code, where this happens:
public virtual string ExtractSignedHeaders(RestRequest request) { List<string> rawHeaders = request.Parameters.Where(parameter => ParameterType.HttpHeader.Equals(parameter.Type)) .Select(header => header.Name.Trim().ToLowerInvariant()) .ToList(); rawHeaders.Sort(StringComparer.OrdinalIgnoreCase); return string.Join(";", rawHeaders); }
The line
List<string> rawHeaders = request.Parameters.Where(parameter => ParameterType.HttpHeader.Equals(parameter.Type)) .Select(header => header.Name.Trim().ToLowerInvariant()) .ToList();
is shown as the source of the problem.
@abuzuhri close?