What is the problem with this conditional loop:
while (System.IO.File.Exists(relPath)){ ... }
It trows an exception when it starts:
Exception Details: System.FormatException: Index (zero based) must be
greater than or equal to zero and less than the size of the argument
list
The relPath string value is a “/Temp/pdfs/file.ext”.
Any help?
The System.FormatException is thrown because a substitution marker was not found in the argument list. If more arguments were provided, the program would not throw an exception.
My answer is copied from here, which provides sample code and shows the simple fix.