The exact error:
Index was out of range. Must be non-negative and less than the size of the collection.
I\'ve index arrays and l
Closures capture variables, not values.
Change the code to the following, and you'll see the issue go away:
for (int i = 0; i < addressList.Count; i++) {
textBox1.Text += ("Task for " + addressList[i] + ":" + portList[i] + " initiated." + Environment.NewLine);
var temp = i;
Task.Factory.StartNew(() => PingTaskAdapted(addressList[temp], portList[temp]));
}