These two snippets of code are supposed to advance a pointer along a buffer until they find a double quote character or reach the end of the buffer.
while (input[startPos] != '"' && startPos < input.Length) startPos++;
while (startPos < input.Length && input[startPos] != '"') startPos++;
One of them works fine. One throws an exception sometimes. Why?