views:

119

answers:

2

I am fairly inexperienced with asp.net ajax and am having a problem where a javascript error is thrown (object not found).

The debugger then stops and points to a substring of my viewstate it looks something like the following (not exactly this since my viewstate is huge) with the section between the ellipses highlighted:

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" 
       value="ObMUE...X78PmJHLJkWcHW4OXxH7/QxjqBI...m2" />

The callstack is equally unhelpful, reading

JScript - form1 anonymous function

What does this mean and how do I go about debugging it?

Edit: As I have stated in some comments, Firebug is not an option. The application is strictly IE only (we're trying to fix that but its a ways off) and doesn't work with any other browser.

A: 

Debugging by browser error messages, especially IE, is notoriously difficult. Even simple error conditions, like an invalid reference, lead to extremely cryptic messages.

I would recommend a good Javascript debugger, such as FireBug. It makes finding and fixing javascript problems much, much easier.

levand
Not an option. Application is IE only. Its actually a baked into the goddamn code that the browser must be IE.
George Mauer
+1  A: 

The line number that is reported in your error is likely misleading. I would recommend stepping through the javascript with a debugger. I usually do this with IE and Visual Studio or the microsoft script debugger (check out this link for directions). There's also a good debugger in Firefox called Firebug.

Or, if you're using Visual Studio 2008 you can just put a breakpoint on a javascript line and hit F5.

EDIT: Whoops, I didn't realize you're already using a debugger. Is your page emitting javascript via ScriptManager.RegisterClientScriptBlock, etc? What about included files, are you using any js frameworks where the error might be coming from?

Kevin Tighe
I know about Firebug, but firefox is not an option
George Mauer
Well if you've got VS2008 just put a breakpoint on a javascript statement and hit play. If not check out http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx for instructions on javascript debugging in IE.
Kevin Tighe
I know about script debugging (otherwise it wouldn't break into the debugger) but like I said, my callstack has exactly one entry and it is "anonymous function". Any way I can look at what exactly that is?
George Mauer