Csla.Net Application Error

Csla.Net Application Error

Old forum URL: forums.lhotka.net/forums/t/4679.aspx


sunil posted on Saturday, April 12, 2008

 I have created the simple CSLA.Net Application.when I am trying to execute the application I am getting the error.It is in the form of Dialog box.

Error:"WebDev.Webserver.exe has encountered a problem and needs to close.We are sorry for the inconvenience."   and

When I am Debugging the Application I am getting the Exception  "StackOverflowException was Unhandled".

Exception:"An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" at the position  "using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))"

The Following code is:

[RunLocal()]

private void DataPortal_Create(Criteria criteria)

{

 

_hiredate.Date = DateTime.Today;

ValidationRules.CheckRules();

}

private void DataPortal_Fetch(Criteria criteria)

{

using (SqlConnection cn = new SqlConnection(Database.employeeConnection))

{

cn.Open();

ExecuteFetch(cn, criteria);

}//using

}

private void ExecuteFetch(SqlConnection cn, Criteria criteria)

{

using (SqlCommand cm = cn.CreateCommand())

{

cm.CommandType = CommandType.Text;

cm.CommandText = "Select empno, empname, hiredate, job,sal,city from employee where empno='" + criteria.empno + "'";

using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))

{

FetchObject(dr);

ValidationRules.CheckRules();

}

}//using

}

protected void FetchObject(SafeDataReader dr)

{

dr.Read();

_empno = dr.GetString("empno");

_empname = dr.GetString("empname");

_hiredate = dr.GetSmartDate("hiredate");

_job = dr.GetString("job");

_sal = dr.GetInt32("sal");

_city = dr.GetString("city");

}

Please help me on this issue.

   If any help would be appreciated.

sergeyb replied on Saturday, April 12, 2008

Nothing immediately obvious.  I would check the rules to see if there is a custom rule that is causing the issue.

 

Sergey Barskiy

Senior Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: sunil [mailto:cslanet@lhotka.net]
Sent: Saturday, April 12, 2008 9:59 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Csla.Net Application Error

 

 I have created the simple CSLA.Net Application.when I am trying to execute the application I am getting the error.It is in the form of Dialog box.

Error:"WebDev.Webserver.exe has encountered a problem and needs to close.We are sorry for the inconvenience."   and

When I am Debugging the Application I am getting the Exception  "StackOverflowException was Unhandled".

Exception:"An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" at the position  "using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))"

The Following code is:

[RunLocal()]

private void DataPortal_Create(Criteria criteria)

{

 

_hiredate.Date = DateTime.Today;

ValidationRules.CheckRules();

}

private void DataPortal_Fetch(Criteria criteria)

{

using (SqlConnection cn = new SqlConnection(Database.employeeConnection))

{

cn.Open();

ExecuteFetch(cn, criteria);

}//using

}

private void ExecuteFetch(SqlConnection cn, Criteria criteria)

{

using (SqlCommand cm = cn.CreateCommand())

{

cm.CommandType = CommandType.Text;

cm.CommandText = "Select empno, empname, hiredate, job,sal,city from employee where empno='" + criteria.empno + "'";

using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))

{

FetchObject(dr);

ValidationRules.CheckRules();

}

}//using

}

protected void FetchObject(SafeDataReader dr)

{

dr.Read();

_empno = dr.GetString("empno");

_empname = dr.GetString("empname");

_hiredate = dr.GetSmartDate("hiredate");

_job = dr.GetString("job");

_sal = dr.GetInt32("sal");

_city = dr.GetString("city");

}

Please help me on this issue.

   If any help would be appreciated.



stefan replied on Saturday, April 12, 2008

Hi,

I experienced a similar behaviour at a costumer a few weeks ago, as we tried to run our app on a new test workstation for the first time. The application crashed at startup, whithout even reaching the first line of code. The message shown did not give any hints. I don't remember if it was exacly the same as the one you got, but at least it sounds similar...

Finally, the solution to this was running windows update,
and install the optional .Net Framework 2.0 Service Pack 1.

Hope that helps. Let us know what it was.

Stefan

Copyright (c) Marimer LLC