0

I'm running an ASP.NET project on IIS locally, and an exception is getting reported back to the web browser after a postback has been handled.

In VS2010, if I look at Debug->Exceptions..., every exception type is checked to break when thrown.

Here's the exception I'm seeing in my browser popup:

Line: 868 Error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.

Here's the response back to the browser I got from Fiddler:

41|error|500|Input string was not in a correct format.|

Of course I googled, and most posts say that attempting to parse a string to an int can cause this. I don't think I'm doing anything like that.

======Edit=======
Removed updatepanel, and now I get:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +12630469
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +224
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +483
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691

=================

thanks, Mark

MStodd
  • 4,716
  • 3
  • 30
  • 50
  • The [PageRequestManager](http://msdn.microsoft.com/en-us/library/bb311028.aspx) class is part of the client-side API, so it's surfacing the error on the client when it's attempting to parse something returned in the response. If you post some more code and accept some more answers I'm sure you'll get a solution. – Town Apr 25 '11 at 19:13
  • I posted the response (which is an exception) above, and the client is parsing and displaying it just fine. This really has very little to do with code, and more to do with me trying to figure out why VS is not breaking even though it looks like an exception is being thrown on the server. – MStodd Apr 25 '11 at 19:38
  • Are you using update panels? Try either setting [EnablePartialRendering](http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.enablepartialrendering.aspx) to false or removing the update panel, then you should see the exception you're after. – Town Apr 25 '11 at 19:47
  • Added call stack. After reflectoring System.Web.UI.WebControls, I'm getting closer to what it having trouble being parsed... – MStodd Apr 25 '11 at 20:24

3 Answers3

1

Problem was that for a button I had in my grid, I was setting the CommandArgument, which I should not be doing. This is used by the GridView to get the row index in case it doesn't have the actual row owning the button.

MStodd
  • 4,716
  • 3
  • 30
  • 50
0

The exception is happening before your code is even invoked. Maybe this? Sys.WebForms.PageRequestManagerServerErrorException 12031

Community
  • 1
  • 1
Jim Bolla
  • 8,265
  • 36
  • 54
0

I don't know about breaking your debugger. By default, this type of error won't break your code. You should have a proper try{}catch{} statement setup for the code that handles your data manipulation. You could even have some debug variables that you could output in your catch{} to help you locate your error if your dealing with lots of data. Run your debugger and iterate through it to find the error.

Nick Rolando
  • 25,879
  • 13
  • 79
  • 119
  • The problem is that I have no idea where the exception is being thrown. I put a try/catch around all my PageLoad code, and around all my button click code. If VS is set up to break on any exception, and an exception occurs, I would expect it to break. – MStodd Apr 25 '11 at 19:13