I converted the pseudo-code here into C#, and have it recursively repeat 10,000 times. But I get a C# runtime error, StackOverflow Exception after 9217
StackOverflow Exception
9217
It's not infinite recursion obviously since it stops after 10,000 levels, but it's still not the best idea.
Ten thousand stack levels is an awful lot - the stack is not a massive resource. You should convert it into an iterative solution.