ASP.NET StackOverflowException

What do you do when ASP.NET throws an exception like this?

Exception of type System.StackOverflowException was thrown.

Description: An
unhandled exception occurred during the execution of the current web request. Please
review the stack trace for more information about the error and where it originated
in the code.

Exception Details: System.StackOverflowException: Exception of type System.StackOverflowException
was thrown.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can be identified
using the exception stack trace below.

Stack Trace:

[StackOverflowException: Exception of type System.StackOverflowException was thrown.]


Version Information: Microsoft .NET Framework
Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

ASP.NET StackOverflowException
  • Dan

    You look at your recent changes for a recursive call.

  • amit

    Hi There,

    If you are using something like Value Objects to move data from ur xxx.aspx.cs to your delegates. Then thers one solution, Take care while creating your ValueObjectClass. ( Dont declare attributes of your value object as property i mean with get and set ). This will work fine.

    Please feel free to contact me if u have any further queries or it dosent solev ur problem.

    Amit

  • Zhang Qi

    Hi:
    Every time I use property, such as
    public string test
    {
    get
    {
    return test;
    }
    set
    {
    test = value;
    }
    }
    this error occur, why this happen? Is it a bug? or any reasonable thing in it?
    Thank you

    Qi

  • Zhang Qi

    Hi:
    Every time I use property, such as
    public string test
    {
    get
    {
    return test;
    }
    set
    {
    test = value;
    }
    }
    this error occur, why this happen? Is it a bug? or any reasonable thing in it?
    Thank you

    Qi

  • Ben

    If you use a property like this:

    public string test
    {
    set
    {
    test=value;
    }
    }

    What you are doing is making an endless recursive call because you are setting the public string value with it’s own value.

    You want something more like this:

    private string secretTest;

    public string test
    {
    set
    {
    secretTest=value;
    }
    }

    When I get a stack overflow it is almost always because my public variable is called something like ThisString and my private one is called thisString and I typo and give them the same name.