I am multithreading with a threadpool and whenever i try to start the requests i get
Object reference not set to an instance of an object.
on
Application.Run(new Form1());
I don’t have the same problem without the proxies tho
This is the code that causes trouble
if (ProxyBox.Text != string.Empty)
{
lock (locker)
{
Random rnd = new Random();
int rndd = rnd.Next(0, int.Parse(ProxyNumber.Text));
request.Proxy = new WebProxy(proxysplit[rndd].ToString());
}
}
Basicaly i want to get a random proxy from the proxysplit array everytime
Any Ideas 😕
There are multiple questions you need to answer before we can help you:
null)?proxysplitinitialized?Check what’s not initialized and you may also want to generate the random number between 0 and the number of elements in
proxysplit:If you use the the
ProxyNumberand the resulting integer is outside the range of theproxysplitarray length, then you may also get an exception while trying to access an element out of range, i.e.ArgumentOutOfRangeException.