This gem is part of a code (C#) example that we got from a vendor recently. This exact same pattern appears multiple times in the example.
It stands out because it does manage work correctly...
using (FileStream rdr = new FileStream(contentInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { { index = 1; while (true) { long offset = (index - 1) * chunkSize; long remaining = contentInfo.Length - offset; if (remaining < 1) break; // Stop processing, at the end of the file // stuff that doesn't ever touch the index variable index++; } }