You must Sign In to post a response.
  • Category: ASP.Net MVC

    Stack overflow exception

    hello Friends,

    we are doing development in MVC 5. After some lines of coding, stack overflow exception is fired.

    Kindly give me solution for this ASAP.

    Thanks in advance,
    Sonal Patel
  • #767664
    Hai Sonal,
    It looks like the issue in the code which you wrote. Most of the times, this kind of issue occurs when there is some loop which goes on continuously and make the error as 'Stack overflow exception'. Because when some loop runs continuously, the memory gets filled completely which causes this error to be displayed.
    You need to check what code is there which is causing this error. There could be any ajax call which is calling continuously. Try using developer tool to find the requests making from browser.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #767677
    "stack overflow exception" is happening because of "nested method calls". Are you using "while loop", "for" etc..
    I think there may be some logic issue to handle it. Please check the loops which you are using in your coding part.
    2. Are you using any recursive function in your code. That will also sometimes create this issue.
    This issue is purely depending on the logic which you used in your code. So if you post some piece of code we can try to find the issue. Otherwise check the logic which not matching in the loops.

    By Nathan
    Direction is important than speed

  • #767682

    Yes agree with above 2 solutions, as per my understand the reason behind stack overflow exception is if there is no end for loop or more nested loops or very deep unbounded recursion that time you may get this type of Stack Overflow exception.

    So, my suggestion is first you have to check your code part in which line you got this error and found the exact issue, why this error occurred.

    Hope this helps you...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • Sign In to post your comments