Stack Exception Error

Results 1 to 2 of 2

Thread: Stack Exception Error

  1. #1
    Join Date
    Dec 1969

    Default Stack Exception Error

    I am developing a small C# app. I keep getting a System.StackOverflowException error when I close my application. I put in my code a close event. In the close event, when the app closes I have a try{}catch{} routine. I throw a message box when the it catches the exception. On my development machine, it catches the exception. On other machines it does not catch the exception but the exception still appears as a JIT message or some other dialog box. If I just hit continue, the application closes with out incident, which is what I wanted it to do in the first place. So my questions are:<BR><BR>1. What is a StackOverFlowException error? I believe it has something to do with methods or forms still being open.<BR>2. How do you prevent this error?<BR>3. How can I handle this error? Is there away to suppress this error or just have it continue without it showing a message, other than going into the "Exceptions" portion of the debug, which I have already tried.<BR><BR>Thanks in advance for your help.

  2. #2
    Join Date
    Dec 1969

    Default Probably from infinite recursion...

    This is easy to cause happen if you are using try/catch and, inside the catch, you call a function that ends up causing the same exception.<BR><BR>Or, perhaps, your close handler does something that causes another close event, so that you keep calling the close handler an infinite number of times.<BR><BR>So, essentially, you keep calling that same function from within itself over and over until you run out of room on the stack (which is where the return address from functions is stored, among other things we won&#039;t bother to go into here).<BR><BR>Yes, I guess you could say it has to do with "methods...still being open", in the sense that the methods get called but never return. I&#039;ve never heard it expressed in those words, but why not.<BR><BR>And you prevent the error by looking at your code and figuring out where you are doing this infinite recursion. <BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts