Sudden and fatal error in my project. Please help! (and debug watching gives 'error: cannot obtain v

L

Lars-Erik Aabech

Hi!

I'm on the 42'nd version of a Web Form that's been working swell since we
started. There's some advanced dhtml that populates tables with data on the
client side, and then post everything to be saved by iterating through
Request.Form. All of a sudden the functionality I use to parse a date is
screwed up and the date stays at today. So I try to debug, but now all I get
is this:

error: evaluation of function 'dtDeadline.ToUniversalTime' cannot take place
because the thread is at a location at which function evaluation is not
possible
(in the immediate window when trying to look at some values)

or this:

error: cannot obtain value
(for Request, Request.Form, Request.Form[0] etc. etc. in the watch window)

The weirdest thing is that I didn't do ANY changes to the server-side code,
and the only changes in the client part since it stopped working was some
dhtml functionality to expand and collapse the tables using the css style
display attribute.

The code that I try to debug (and that suddenly stopped evaluating my dates)
is a fairly simple code-behind class, the method is included at the bottom
of this post.

More valuable info for you if you think you can help: (i hope)
* The problem occurs on all servers including my development machine
* There are NO multithreading
* There are no streams in use except Response if it counts.


Praying for help...
Lars-Erik


// CANNOT WATCH ANY OBJECTS IT SEEMS, ONLY THE STD. DATATYPES

private bool save()
{
TargetsForPerson dsTargets = new TargetsForPerson();
bool bRet = false;
int iTargetID = 0;
int iTargetParentID = 0;
int iInterviewTargetID = 0;
string sCode = "";
string sName = "";
DateTime dtDeadline = DateTime.Now;
string sValueType = "";
string sValue = "";
double dWeight = 0.0;
string sAction = "";
string sResponsible = "";
string sComment = "";
int iRoleID = 0;
int iDepartmentID = 0;

for (int i = 0; i<System.Convert.ToInt32(Request.Form["hidCount"]); i++)
{
if (Convert.ToInt32(Request.Form["oTargetList_per_mal_slettet_" +
i.ToString()]) != 0)
{

m_aiInterview.deleteTarget(Convert.ToInt32(Request.Form["oTargetList_per_mal
_id_" + i.ToString()]));
}
else
{
if (Request.Form["oTargetList_mal_id_" + i.ToString()] != null)
iTargetID =
System.Convert.ToInt32(Request.Form["oTargetList_mal_id_" + i.ToString()]);
if (Request.Form["oTargetList_ParentID_" + i.ToString()] !=
null)
iTargetParentID =
System.Convert.ToInt32(Request.Form["oTargetList_ParentID_" +
i.ToString()]);
if (Request.Form["oTargetList_per_mal_id_" + i.ToString()] !=
null)
iInterviewTargetID =
System.Convert.ToInt32(Request.Form["oTargetList_per_mal_id_" +
i.ToString()]);
if (Request.Form["oTargetList_Code_" + i.ToString()] != null)
sCode = Request.Form["oTargetList_Code_" + i.ToString()];
if (Request.Form["oTargetList_Name_" + i.ToString()] != null)
sName = Request.Form["oTargetList_Name_" + i.ToString()];
if (Request.Form["oTargetList_Deadline_" + i.ToString()] !=
null)
{
// HERE BE DRAGONS!! THIS WORKED BEFORE!!!!
string sDeadline = Request.Form["oTargetList_Deadline_" +
i.ToString()];
dtDeadline = System.Convert.ToDateTime(sDeadline);
}
if (Request.Form["oTargetList_ValueType_" + i.ToString()] !=
null)
sValueType = Request.Form["oTargetList_ValueType_" +
i.ToString()];
if (Request.Form["oTargetList_Value_" + i.ToString()] != null)
sValue = Request.Form["oTargetList_Value_" + i.ToString()];
if (Request.Form["oTargetList_Weight_" + i.ToString()] != null)
dWeight =
System.Convert.ToDouble(System.Convert.ToDouble(Request.Form["oTargetList_We
ight_" + i.ToString()].Replace(".", ",")));
if (Request.Form["oTargetList_Action_" + i.ToString()] != null)
sAction = Request.Form["oTargetList_Action_" +
i.ToString()];
if (Request.Form["oTargetList_Responsible_" + i.ToString()] !=
null)
sResponsible = Request.Form["oTargetList_Responsible_" +
i.ToString()];
if (Request.Form["oTargetList_Comment_" + i.ToString()] != null)
sComment = Request.Form["oTargetList_Comment_" +
i.ToString()];
if (Request.Form["oTargetList_RoleID_" + i.ToString()] != null)
{
if (Request.Form["oTargetList_RoleID_" + i.ToString()] ==
"")
iRoleID = 0;
else
iRoleID =
System.Convert.ToInt32(Request.Form["oTargetList_RoleID_" + i.ToString()]);
}
if (Request.Form["oTargetList_DepartmentID_" + i.ToString()] !=
null)
{
if (Request.Form["oTargetList_DepartmentID_" + i.ToString()]
== "")
iDepartmentID = 0;
else
iDepartmentID =
System.Convert.ToInt32(Request.Form["oTargetList_DepartmentID_" +
i.ToString()]);
}
TargetsForPerson.TargetForPersonRow tr =
dsTargets.TargetForPerson.AddTargetForPersonRow(iTargetID,
iTargetParentID, m_iTargetType, sName, "",
0, iInterviewTargetID, 0, iTargetID, 0, sValue, sValueType,
DateTime.Now, m_aiInterview.Date, DateTime.Now,
dtDeadline, sComment, sAction, sResponsible, iDepartmentID,
iRoleID, false, 0, 0, sCode, dWeight,
0, 0, 0, "", 0, "", DateTime.Now, "", "", "");
tr.Setper_mal_deaktivertdatoNull();
tr.Setper_mal_deaktivert_ms_idNull();
}
}
try
{
if (!m_aiInterview.Locked)
m_aiInterview.saveTargets(dsTargets);
bRet = true;
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
bRet = false;
}
return bRet;
}
 
L

Lars-Erik Aabech

Umm.. the date issue was a glitch in my matrix (wrong parameter in the wrong
place).. But still - why the .... couldn't I debug???

L-E

Lars-Erik Aabech said:
Hi!

I'm on the 42'nd version of a Web Form that's been working swell since we
started. There's some advanced dhtml that populates tables with data on the
client side, and then post everything to be saved by iterating through
Request.Form. All of a sudden the functionality I use to parse a date is
screwed up and the date stays at today. So I try to debug, but now all I get
is this:

error: evaluation of function 'dtDeadline.ToUniversalTime' cannot take place
because the thread is at a location at which function evaluation is not
possible
(in the immediate window when trying to look at some values)

or this:

error: cannot obtain value
(for Request, Request.Form, Request.Form[0] etc. etc. in the watch window)

The weirdest thing is that I didn't do ANY changes to the server-side code,
and the only changes in the client part since it stopped working was some
dhtml functionality to expand and collapse the tables using the css style
display attribute.

The code that I try to debug (and that suddenly stopped evaluating my dates)
is a fairly simple code-behind class, the method is included at the bottom
of this post.

More valuable info for you if you think you can help: (i hope)
* The problem occurs on all servers including my development machine
* There are NO multithreading
* There are no streams in use except Response if it counts.


Praying for help...
Lars-Erik


// CANNOT WATCH ANY OBJECTS IT SEEMS, ONLY THE STD. DATATYPES

private bool save()
{
TargetsForPerson dsTargets = new TargetsForPerson();
bool bRet = false;
int iTargetID = 0;
int iTargetParentID = 0;
int iInterviewTargetID = 0;
string sCode = "";
string sName = "";
DateTime dtDeadline = DateTime.Now;
string sValueType = "";
string sValue = "";
double dWeight = 0.0;
string sAction = "";
string sResponsible = "";
string sComment = "";
int iRoleID = 0;
int iDepartmentID = 0;

for (int i = 0; i<System.Convert.ToInt32(Request.Form["hidCount"]); i++)
{
if (Convert.ToInt32(Request.Form["oTargetList_per_mal_slettet_" +
i.ToString()]) != 0)
{

m_aiInterview.deleteTarget(Convert.ToInt32(Request.Form["oTargetList_per_mal
_id_" + i.ToString()]));
}
else
{
if (Request.Form["oTargetList_mal_id_" + i.ToString()] != null)
iTargetID =
System.Convert.ToInt32(Request.Form["oTargetList_mal_id_" + i.ToString()]);
if (Request.Form["oTargetList_ParentID_" + i.ToString()] !=
null)
iTargetParentID =
System.Convert.ToInt32(Request.Form["oTargetList_ParentID_" +
i.ToString()]);
if (Request.Form["oTargetList_per_mal_id_" + i.ToString()] !=
null)
iInterviewTargetID =
System.Convert.ToInt32(Request.Form["oTargetList_per_mal_id_" +
i.ToString()]);
if (Request.Form["oTargetList_Code_" + i.ToString()] != null)
sCode = Request.Form["oTargetList_Code_" + i.ToString()];
if (Request.Form["oTargetList_Name_" + i.ToString()] != null)
sName = Request.Form["oTargetList_Name_" + i.ToString()];
if (Request.Form["oTargetList_Deadline_" + i.ToString()] !=
null)
{
// HERE BE DRAGONS!! THIS WORKED BEFORE!!!!
string sDeadline = Request.Form["oTargetList_Deadline_" +
i.ToString()];
dtDeadline = System.Convert.ToDateTime(sDeadline);
}
if (Request.Form["oTargetList_ValueType_" + i.ToString()] !=
null)
sValueType = Request.Form["oTargetList_ValueType_" +
i.ToString()];
if (Request.Form["oTargetList_Value_" + i.ToString()] != null)
sValue = Request.Form["oTargetList_Value_" + i.ToString()];
if (Request.Form["oTargetList_Weight_" + i.ToString()] != null)
dWeight =
System.Convert.ToDouble(System.Convert.ToDouble(Request.Form["oTargetList_We
ight_" + i.ToString()].Replace(".", ",")));
if (Request.Form["oTargetList_Action_" + i.ToString()] != null)
sAction = Request.Form["oTargetList_Action_" +
i.ToString()];
if (Request.Form["oTargetList_Responsible_" + i.ToString()] !=
null)
sResponsible = Request.Form["oTargetList_Responsible_" +
i.ToString()];
if (Request.Form["oTargetList_Comment_" + i.ToString()] != null)
sComment = Request.Form["oTargetList_Comment_" +
i.ToString()];
if (Request.Form["oTargetList_RoleID_" + i.ToString()] != null)
{
if (Request.Form["oTargetList_RoleID_" + i.ToString()] ==
"")
iRoleID = 0;
else
iRoleID =
System.Convert.ToInt32(Request.Form["oTargetList_RoleID_" + i.ToString()]);
}
if (Request.Form["oTargetList_DepartmentID_" + i.ToString()] !=
null)
{
if (Request.Form["oTargetList_DepartmentID_" + i.ToString()]
== "")
iDepartmentID = 0;
else
iDepartmentID =
System.Convert.ToInt32(Request.Form["oTargetList_DepartmentID_" +
i.ToString()]);
}
TargetsForPerson.TargetForPersonRow tr =
dsTargets.TargetForPerson.AddTargetForPersonRow(iTargetID,
iTargetParentID, m_iTargetType, sName, "",
0, iInterviewTargetID, 0, iTargetID, 0, sValue, sValueType,
DateTime.Now, m_aiInterview.Date, DateTime.Now,
dtDeadline, sComment, sAction, sResponsible, iDepartmentID,
iRoleID, false, 0, 0, sCode, dWeight,
0, 0, 0, "", 0, "", DateTime.Now, "", "", "");
tr.Setper_mal_deaktivertdatoNull();
tr.Setper_mal_deaktivert_ms_idNull();
}
}
try
{
if (!m_aiInterview.Locked)
m_aiInterview.saveTargets(dsTargets);
bRet = true;
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
bRet = false;
}
return bRet;
}
 
Top