tatton777
asked on
Why is this website throwing StackOverflow exception
Hello,
I am creating instances of objects within my website so I can use them. Why is this throwing stackoverflow. Here is a mockup of the partical classes and classes. Error is firing in MSF_Methods class on the "private SessionVariables sv = new SessionVariables()"
website root partial class Default.aspx code behind:
these four classes are in app_code folder
I am creating instances of objects within my website so I can use them. Why is this throwing stackoverflow. Here is a mockup of the partical classes and classes. Error is firing in MSF_Methods class on the "private SessionVariables sv = new SessionVariables()"
website root partial class Default.aspx code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using UserSession;
using MySchoolFeesMethods;
public partial class _Default : System.Web.UI.Page
{
private SessionVariables sv = new SessionVariables();
private MSF_Methods MSF = new MSF_Methods();
protected void Page_Load(object sender, EventArgs e)
{
}
}
these four classes are in app_code folder
using System;
using MySchoolFeesStrings;
using MsfSisMethods;
using UserSession;
namespace MySchoolFeesMethods
{
public class MSF_Methods
{
private SessionVariables sv = new SessionVariables(); // Overflow on this line
private MSF_Strings STG = new MSF_Strings();
private MSF_SIS SIS = new MSF_SIS();
}
// End Namespace Block
}
using System;
using System.Linq;
using UserSession;
using MySchoolFeesMethods;
using MySchoolFeesStrings;
/// <summary>
/// Summary description for MSF_SIS
/// </summary>
///
namespace MsfSisMethods
{
public class MSF_SIS
{
private SessionVariables sv = new SessionVariables();
private MSF_Methods MSF = new MSF_Methods();
private MSF_Strings STG = new MSF_Strings();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UserSession;
using MySchoolFeesMethods;
/// <summary>
/// Summary description for MSF_Strings
/// </summary>
///
///
namespace MySchoolFeesStrings
{
public class MSF_Strings
{
}
}
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using MySchoolFeesMethods;
using System.Collections;
using MySchoolFeesStrings;
namespace UserSession
{
/// <summary>
/// Summary description for clsSessionVariables.
/// </summary>
public class SessionVariables
{
}
}
ASKER
This is just a skeleton but it produces the same error. I tried to attach a .zip of the website the code above but zip was rejected by experts-exchange.
You have to remove the bin and obj folders as well as any *.settings files and the project should upload fine. Alternatively, you might try using www.ee-stuff.com to upload the file. It's not hosted by EE, but it is affiliated, in a roundabout way (not officially).
ASKER
Thanks. Here is the website that contains a skeleton of that reproduces the error.
stckOverflowMockup.zip
stckOverflowMockup.zip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry to be dumb. This is the first time I've experienced this. Can you give an example.
I don't have any clue as to what you're trying to achieve with your code. What is your "business" purpose here?
ASKER
I have a foundational misunderstanding uf classes and namespaces. This helped me understand where the softness in my thinking is. Now I just need to do some reading and researching.
I hope I didn't run you off with my previous comment. It wasn't intended to sound off-putting. I only intended to convey that it would be difficult for me to tell you how to adjust the code without knowing what your goal is. The short answer to your question is to either remove:
...from MSF_SIS, either of which may break your design. It depends on what you are trying to accomplish = )
private MSF_SIS SIS = new MSF_SIS();
...from MSF_Methods *or* remove:
private MSF_Methods MSF = new MSF_Methods();
...from MSF_SIS, either of which may break your design. It depends on what you are trying to accomplish = )
ASKER
Thanks. After doing some reading on organizing classes and namespaces and folders I am seeing that I have some restructuring to do. Thanks for your help! Take care.
Is there any code defined in
Open in new window
?