I am getting the error at getProxy()
, the error is index outofbounds.
Error:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information:
Index was out of range. Must be non-negative and less than the size of the collection.
Code:
static List<String> proxies = new List<String>();
private static String getProxy()
{
lock (proxies)
{
return proxies[new Random().Next(0, proxies.Count)];
}
}
It is not empty, has a proxy inside, the error is not in my loading function, it is here.
I have added a breakpoint and debugged it, proxies has the value of Count = 3 and proxies.count has the value of 3.