views:

170

answers:

3

Hi

I have health monitoring turned on, and i have the following error i'm trying to understand:

Exception:

Exception information:
    Exception type: System.InvalidCastException
    Exception message: Specified cast is not valid.


Thread information:
    Thread ID: 5
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at _Default.Repeater1_ItemDataBound(Object sender, RepeaterItemEventArgs e)
   at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource)
   at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)
   at _Default.up1_Load()
   at _Default.Timer1_Tick(Object sender, EventArgs e)
   at System.Web.UI.Timer.OnTick(EventArgs e)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I'm just trying to figure out exactly where the problem is happening and what it is - is it happening in the Repeater1_ItemDataBound sub routine, or in the Timer1_Tick sub routine? Is the last thing that happened before the error occured at the top or bottom of the trace?

any help much appreciated

thanks

A: 

In your itemdatabound but there is no evidence of what the error is, its a trace so 1st thing is the upper most (last) problem and the items below it are the route it took to get there

It looks like you are casting something wrong, maybe a control? e.g a textbox to a label by mistake?

tigermain
A: 

Read it from bottom to top - the function where the exception occurred is at the top.

slugster
+2  A: 

The wikipedia entry on stack traces should help a little, but essentially a stack trace is a list of methods / functions that a thread / the program is in at a given time (usually during an exception).

The top most line in a stack trace is the method / function that the thread / program is "currently in" (i.e. currently executing), the next line is the method / function that is calling the method given in the line above, etc...

So for example, if I have the following code (in C#):

void Timer1_Tick()
{
    SomeMethod();
}

void SomeMethod()
{
    AnotherMethod();
}

void AnotherMethod()
{
    // Suppose I have a exception / stack trace taken at this point
}

I might get the following stack trace:

AnotherMethod()
SomeMethod()
Timer1_Tick()

In short - its likely that your error is somewhere in the method Repeater1_ItemDataBound, as that is the "outermost" / topmost method in your stack trace.

Kragen