I dont even know what caused it in my application. What is it? I created a new instance of a class (the class was in another file), but at the first time I call a method it throws a StackOverFlow exception.
The only thing that I think would logically throw a stackoverflow exception would be if someone downvoted Jon Skeet.
But seriously now, what is it? I got around it by creating another class in the same file as the first class and using that to call the methods for me.
As a general rule, a stack overflow exception is caused by a recursive algorithm where the depth of recursion has exceeded the (typically) fixed stack limit. This is usually a result of a bug in the algorithm, but it may also be caused by the data structure you are applying the algorithm to being too “deep”.
Here’s a trivial example of a buggy recursion (in no particular PL).
Calling length for any non-empty list will give a stack overflow in a typical programming language. But even if you correct the bug, calling the method for a long list is likely to cause a stack overflow.
(The exception is when you use a language … or more strictly a compiler … that supports tail recursion optimization.)