Sound like a data issue, these work around will stop the error but it might pollute the results. You need to find out what when wrong in Allbarcodes[i]
1. Use TryParse, if failed substitute with 0
long sumOfnum = 0;
Int64.TryParse(Allbarcodes[i], out sumOfnum);
barcodeList.Add(sumOfnum);
2.check if Allbarcodes[i] is empty before converting
if (!string.IsNullOrEmpty(Allbarcodes[i]) )
{
long sumOfnum = Summation(Convert.ToInt64(Allbarcodes[i]));
barcodeList.Add(sumOfnum);
}