Actually I don't know what happens. But you can find it by putting a break point. I can help in this point.
1- declare a variable for the processed line count:
int lineC=0;
2- add if clause in the loop, and put the breakpoint here.
while(<condition>) {
if(lineC==9999) {
Console.Writeline("i am here");
}
lineC++;
}</condition>
then you can easily trace what happens.