Click here to Skip to main content
14,971,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello all,
I'm developing a windows mobile app and I often get a StackOverflowException. For what I can see, is that it comes because a lot a forms remain open, even when I dispose them every time I open a new one. I use a global class to get values from one form to another. Any idea why I get this exception? I don't have loops or things like this.

Thanks in advance.
Updated 23-Jul-12 4:31am
Rajesh Varma Buddaraju 23-Jul-12 10:37am
Provide your code if possible so that way it will be easy to trace.

1 solution

It generally isn't loops that cause Stack Overflow - it's unterminated recursion.

Check your code: is there anywhere where a method calls itself, directly or indirectly?
IviKAZAZI 23-Jul-12 10:37am
No,i dont think so. Could it be the form load event the cause? Because i have some piece of code there,where i do some checking,some if else etc. The function i recall in the code is the datagrid_fill to update it,after adding some rows in db.
OriginalGriff 23-Jul-12 10:52am
Without actually seeing it? Can't say! :laugh:
Sergey Alexandrovich Kryukov 23-Jul-12 16:49pm
Stack has nothing to do with open forms; it affects the volume of heap memory and unmanaged resources, not stack.
I may not thing so, but your problem is recursion.
Sergey Alexandrovich Kryukov 23-Jul-12 16:49pm
It's recursion; my 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900