 <p><code>StackOverflowException</code> is usually caused by some method which invokes itself endlessly.</p> <p>The fact that it occurs after some time makes me even more adamant about it: you're facing infinite recursion.</p> <p>An extremely simple example of this behavior would be:</p> <pre><code>void SomeMethod() { SomeMethod(); // StackOverflowException } </code></pre>