Monday 6 October 2014

StackOverflowException - Quite obvious

It isn't all that difficult to hit StackOverflowException as opposed to what I would typically like to believe.

Create a console application with default settings. Add a simple class which has a single method which calls itself recursively.




Call the function from the Main function. e.g.



This produces error. If it doesn't then try changing the value such that it starts to produce the error :).


Lower the value to like 3000 instead of 3371. And we get a successful response.



Always interesting to break software. At least sometimes.

No comments:

Post a Comment