Edit: Nevermind the rest of my post. It was a race condition. That happened apparently during the final AddRange part. Apparently either array was different sizes during growth step and the actuall copy. And to such a degree, the internal array had not grown enough.
A simple lock block covering all writing work on either array should fix that right up.
Original Answer - can be ignored
Your title explains it. You get a argument exception because you try to add a empty list to a existing list. This is not a valid operation according to the designers of the AddRange() Function.
ArgumentException has a very narrow purpose:
The exception that is thrown when one of the arguments provided to a method is not valid.
ArgumentException is thrown when a method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method. The ParamName property identifies the invalid argument.
As it has that one purpose, it needs no special mention for every case it could happen on every single function call. Indeed you should be encounraged to throw it yourself.
To avoid this, do not feed empty lists into AddRange(). It would be trivial for checking that:
if(ListB.Lent > 0){
ListA.AddRange(ListB);
}
As you provided 0 information on how ListB is created, we can not tell you why it sometimes is empty at this point. It just is and it is easily checked.
I use these two articles as the basis for my Exception handling:
This exception is plain and simple a case of a Boneheaded Exception. There is a remote argument for a empty list being not that Exceptional. However the designers of AddRange() felt it is exeptional enough to warant a exception. It is also trivially avoided with a basic if, so it can not really be classed as Vexing Exception. So even after all considerations, it is still just a Boneheaded exception. Please stop causing it.